Merge branch 'main' into release/v0.1
This commit is contained in:
commit
d2fb5e3955
215 changed files with 16319 additions and 7337 deletions
49
.github/workflows/build-and-push.yml
vendored
Normal file
49
.github/workflows/build-and-push.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
name: "Build GARM images"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
push_to_project:
|
||||
description: "Project to build images for"
|
||||
required: true
|
||||
default: "ghcr.io/cloudbase"
|
||||
ref:
|
||||
description: "Ref to build"
|
||||
required: true
|
||||
default: "main"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
images:
|
||||
permissions:
|
||||
packages: write
|
||||
name: "Build GARM images"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: src/github.com/cloudbase/garm
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
cd src/github.com/cloudbase/garm
|
||||
VERSION=$(git describe --tags --match='v[0-9]*' --always ${{ github.event.inputs.ref }})
|
||||
docker buildx build \
|
||||
--provenance=false \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--build-arg="GARM_REF=${{ github.event.inputs.ref }}" \
|
||||
-t ${{ github.event.inputs.push_to_project }}/garm:"${VERSION}" \
|
||||
--push .
|
||||
32
Dockerfile
32
Dockerfile
|
|
@ -1,11 +1,29 @@
|
|||
FROM docker.io/golang:alpine
|
||||
FROM docker.io/golang:alpine AS builder
|
||||
ARG GARM_REF
|
||||
|
||||
WORKDIR /root
|
||||
USER root
|
||||
LABEL stage=builder
|
||||
|
||||
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc
|
||||
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers
|
||||
RUN git config --global --add safe.directory /build
|
||||
|
||||
ADD ./scripts/build-static.sh /build-static.sh
|
||||
RUN chmod +x /build-static.sh
|
||||
ADD . /build/garm
|
||||
RUN cd /build/garm && git checkout ${GARM_REF}
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-azure /build/garm-provider-azure
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-openstack /build/garm-provider-openstack
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
RUN cd /build/garm && go build -o /bin/garm \
|
||||
-tags osusergo,netgo,sqlite_omit_load_extension \
|
||||
-ldflags "-linkmode external -extldflags '-static' -s -w -X main.Version=$(git describe --tags --match='v[0-9]*' --dirty --always)" \
|
||||
/build/garm/cmd/garm
|
||||
RUN mkdir -p /opt/garm/providers.d
|
||||
RUN cd /build/garm-provider-azure && go build -ldflags="-linkmode external -extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-azure .
|
||||
RUN cd /build/garm-provider-openstack && go build -ldflags="-linkmode external -extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-openstack .
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /bin/garm /bin/garm
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-openstack /opt/garm/providers.d/garm-provider-openstack
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-azure /opt/garm/providers.d/garm-provider-azure
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
ENTRYPOINT ["/bin/garm", "-config", "/etc/garm/config.toml"]
|
||||
|
|
|
|||
15
Dockerfile.build-static
Normal file
15
Dockerfile.build-static
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
FROM docker.io/golang:alpine
|
||||
|
||||
WORKDIR /root
|
||||
USER root
|
||||
|
||||
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc
|
||||
|
||||
RUN wget http://musl.cc/aarch64-linux-musl-cross.tgz -O /tmp/aarch64-linux-musl-cross.tgz && \
|
||||
tar --strip-components=1 -C /usr/local -xzf /tmp/aarch64-linux-musl-cross.tgz && \
|
||||
rm /tmp/aarch64-linux-musl-cross.tgz
|
||||
|
||||
ADD ./scripts/build-static.sh /build-static.sh
|
||||
RUN chmod +x /build-static.sh
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
2
Makefile
2
Makefile
|
|
@ -15,7 +15,7 @@ default: build
|
|||
.PHONY : build-static test install-lint-deps lint go-test fmt fmtcheck verify-vendor verify
|
||||
build-static:
|
||||
@echo Building garm
|
||||
docker build --tag $(IMAGE_TAG) .
|
||||
docker build --tag $(IMAGE_TAG) -f Dockerfile.build-static .
|
||||
docker run --rm -e USER_ID=$(USER_ID) -e USER_GROUP=$(USER_GROUP) -v $(PWD):/build/garm:z $(IMAGE_TAG) /build-static.sh
|
||||
@echo Binaries are available in $(PWD)/bin
|
||||
|
||||
|
|
|
|||
127
README.md
127
README.md
|
|
@ -1,14 +1,14 @@
|
|||
# GitHub Actions Runner Manager (garm)
|
||||
# GitHub Actions Runner Manager (GARM)
|
||||
|
||||
[](https://github.com/cloudbase/garm/actions/workflows/go-tests.yml)
|
||||
|
||||
Welcome to garm!
|
||||
Welcome to GARM!
|
||||
|
||||
Garm enables you to create and automatically maintain pools of [self-hosted GitHub runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners), with autoscaling that can be used inside your github workflow runs.
|
||||
|
||||
The goal of ```garm``` is to be simple to set up, simple to configure and simple to use. It is a single binary that can run on any GNU/Linux machine without any other requirements other than the providers it creates the runners in. It is intended to be easy to deploy in any environment and can create runners in any system you can write a provider for. There is no complicated setup process and no extremely complex concepts to understand. Once set up, it's meant to stay out of your way.
|
||||
The goal of ```GARM``` is to be simple to set up, simple to configure and simple to use. It is a single binary that can run on any GNU/Linux machine without any other requirements other than the providers it creates the runners in. It is intended to be easy to deploy in any environment and can create runners in any system you can write a provider for. There is no complicated setup process and no extremely complex concepts to understand. Once set up, it's meant to stay out of your way.
|
||||
|
||||
Garm supports creating pools on either GitHub itself or on your own deployment of [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.5/admin/overview/about-github-enterprise-server). For instructions on how to use ```garm``` with GHE, see the [credentials](/doc/github_credentials.md) section of the documentation.
|
||||
Garm supports creating pools on either GitHub itself or on your own deployment of [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.5/admin/overview/about-github-enterprise-server). For instructions on how to use ```GARM``` with GHE, see the [credentials](/doc/github_credentials.md) section of the documentation.
|
||||
|
||||
## Join us on slack
|
||||
|
||||
|
|
@ -18,121 +18,36 @@ Whether you're running into issues or just want to drop by and say "hi", feel fr
|
|||
|
||||
## Installing
|
||||
|
||||
## Build from source
|
||||
Check out the [quickstart](/doc/quickstart.md) document for instructions on how to install ```GARM```. If you'd like to build from source, check out the [building from source](/doc/building_from_source.md) document.
|
||||
|
||||
You need to have Go installed, then run:
|
||||
## Installing external providers
|
||||
|
||||
```bash
|
||||
git clone https://github.com/cloudbase/garm
|
||||
cd garm
|
||||
go install ./...
|
||||
```
|
||||
External providers are binaries that GARM calls into to create runners in a particular IaaS. There are currently two external providers available:
|
||||
|
||||
You should now have both ```garm``` and ```garm-cli``` in your ```$GOPATH/bin``` folder.
|
||||
* [OpenStack](https://github.com/cloudbase/garm-provider-openstack)
|
||||
* [Azure](https://github.com/cloudbase/garm-provider-azure)
|
||||
|
||||
If you have docker/podman installed, you can also build statically linked binaries by running:
|
||||
|
||||
```bash
|
||||
make build-static
|
||||
```
|
||||
|
||||
The ```garm``` and ```garm-cli``` binaries will be built and copied to the ```bin/``` folder in your current working directory.
|
||||
|
||||
## Install the service
|
||||
|
||||
Add a new system user:
|
||||
|
||||
```bash
|
||||
useradd --shell /usr/bin/false \
|
||||
--system \
|
||||
--groups lxd \
|
||||
--no-create-home garm
|
||||
```
|
||||
|
||||
The ```lxd``` group is only needed if you have a local LXD install and want to connect to the unix socket to use it. If you're connecting to a remote LXD server over TCP, you can skip adding the ```garm``` user to the ```lxd``` group.
|
||||
|
||||
Copy the binary to somewhere in the system ```$PATH```:
|
||||
|
||||
```bash
|
||||
sudo cp $(go env GOPATH)/bin/garm /usr/local/bin/garm
|
||||
```
|
||||
|
||||
Or if you built garm using ```make```:
|
||||
|
||||
```bash
|
||||
sudo cp ./bin/garm /usr/local/bin/garm
|
||||
```
|
||||
|
||||
Create the config folder:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/garm
|
||||
```
|
||||
|
||||
Copy the config template:
|
||||
|
||||
```bash
|
||||
sudo cp ./testdata/config.toml /etc/garm/
|
||||
```
|
||||
|
||||
Copy the external provider (optional):
|
||||
|
||||
```bash
|
||||
sudo cp -a ./contrib/providers.d /etc/garm/
|
||||
```
|
||||
|
||||
Copy the systemd service file:
|
||||
|
||||
```bash
|
||||
sudo cp ./contrib/garm.service /etc/systemd/system/
|
||||
```
|
||||
|
||||
Change permissions on config folder:
|
||||
|
||||
```bash
|
||||
sudo chown -R garm:garm /etc/garm
|
||||
sudo chmod 750 -R /etc/garm
|
||||
```
|
||||
|
||||
Enable the service:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable garm
|
||||
```
|
||||
|
||||
Customize the config in ```/etc/garm/config.toml```, and start the service:
|
||||
|
||||
```bash
|
||||
sudo systemctl start garm
|
||||
```
|
||||
Follow the instructions in the README of each provider to install them.
|
||||
|
||||
## Configuration
|
||||
|
||||
The ```garm``` configuration is a simple ```toml```. A sample of the config file can be found in [the testdata folder](/testdata/config.toml).
|
||||
The ```GARM``` configuration is a simple ```toml```. The sample config file in [the testdata folder](/testdata/config.toml) is fairly well commented and should be enough to get you started. The configuration file is split into several sections, each of which is documented in its own page. The sections are:
|
||||
|
||||
There are 3 major sections of the config that require your attention:
|
||||
* [The default section](/doc/config_default.md)
|
||||
* [Database](/doc/database.md)
|
||||
* [Github credentials](/doc/github_credentials.md)
|
||||
* [Providers](/doc/providers.md)
|
||||
* [Metrics](/doc/config_metrics.md)
|
||||
* [JWT authentication](/doc/config_jwt_auth.md)
|
||||
* [API server](/doc/config_api_server.md)
|
||||
|
||||
* [Github credentials section](/doc/github_credentials.md)
|
||||
* [Providers section](/doc/providers.md)
|
||||
* [The database section](/doc/database.md)
|
||||
## Optimizing your runners
|
||||
|
||||
Once you've configured your database, providers and github credentials, you'll need to configure your [webhooks and the callback_url](/doc/webhooks_and_callbacks.md).
|
||||
|
||||
At this point, you should be done. Have a look at the [running garm document](/doc/running_garm.md) for usage instructions and available features.
|
||||
|
||||
If you would like to use ```garm``` with a different IaaS than the ones already available, have a look at the [writing an external provider](/doc/external_provider.md) page.
|
||||
|
||||
If you like to optimize the startup time of new instance, take a look at the [performance considerations](/doc/performance_considerations.md) page.
|
||||
|
||||
## Security considerations
|
||||
|
||||
Garm does not apply any ACLs of any kind to the instances it creates. That task remains in the responsibility of the user. [Here is a guide for creating ACLs in LXD](https://linuxcontainers.org/lxd/docs/master/howto/network_acls/). You can of course use ```iptables``` or ```nftables``` to create any rules you wish. I recommend you create a separate isolated lxd bridge for runners, and secure it using ACLs/iptables/nftables.
|
||||
|
||||
You must make sure that the code that runs as part of the workflows is trusted, and if that cannot be done, you must make sure that any malicious code that will be pulled in by the actions and run as part of a workload, is as contained as possible. There is a nice article about [securing your workflow runs here](https://blog.gitguardian.com/github-actions-security-cheat-sheet/).
|
||||
If you would like to optimize the startup time of new instance, take a look at the [performance considerations](/doc/performance_considerations.md) page.
|
||||
|
||||
## Write your own provider
|
||||
|
||||
The providers are interfaces between ```garm``` and a particular IaaS in which we spin up GitHub Runners. These providers can be either **native** or **external**. The **native** providers are written in ```Go```, and must implement [the interface defined here](https://github.com/cloudbase/garm/blob/main/runner/common/provider.go#L22-L39). **External** providers can be written in any language, as they are in the form of an external executable that ```garm``` calls into.
|
||||
The providers are interfaces between ```GARM``` and a particular IaaS in which we spin up GitHub Runners. These providers can be either **native** or **external**. The **native** providers are written in ```Go```, and must implement [the interface defined here](https://github.com/cloudbase/garm/blob/main/runner/common/provider.go#L22-L39). **External** providers can be written in any language, as they are in the form of an external executable that ```GARM``` calls into.
|
||||
|
||||
There is currently one **native** provider for [LXD](https://linuxcontainers.org/lxd/) and two **external** providers for [Openstack and Azure](/contrib/providers.d/).
|
||||
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
gErrors "github.com/cloudbase/garm/errors"
|
||||
"github.com/cloudbase/garm/metrics"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner"
|
||||
"github.com/cloudbase/garm/util"
|
||||
wsWriter "github.com/cloudbase/garm/websocket"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
|
|
@ -202,6 +202,13 @@ func (a *APIController) NotFoundHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /metrics-token metrics-token GetMetricsToken
|
||||
//
|
||||
// Returns a JWT token that can be used to access the metrics endpoint.
|
||||
//
|
||||
// Responses:
|
||||
// 200: JWTResponse
|
||||
// 401: APIErrorResponse
|
||||
func (a *APIController) MetricsTokenHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -222,6 +229,21 @@ func (a *APIController) MetricsTokenHandler(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route POST /auth/login login Login
|
||||
//
|
||||
// Logs in a user and returns a JWT token.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Login information.
|
||||
// type: PasswordLoginParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: JWTResponse
|
||||
// 400: APIErrorResponse
|
||||
//
|
||||
// LoginHandler returns a jwt token
|
||||
func (a *APIController) LoginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var loginInfo runnerParams.PasswordLoginParams
|
||||
|
|
@ -253,6 +275,20 @@ func (a *APIController) LoginHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route POST /first-run first-run FirstRun
|
||||
//
|
||||
// Initialize the first run of the controller.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Create a new user.
|
||||
// type: NewUserParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: User
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) FirstRunHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if a.auth.IsInitialized() {
|
||||
err := gErrors.NewConflictError("already initialized")
|
||||
|
|
@ -279,6 +315,13 @@ func (a *APIController) FirstRunHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /credentials credentials ListCredentials
|
||||
//
|
||||
// List all credentials.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Credentials
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) ListCredentials(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
creds, err := a.r.ListCredentials(ctx)
|
||||
|
|
@ -293,6 +336,13 @@ func (a *APIController) ListCredentials(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /providers providers ListProviders
|
||||
//
|
||||
// List all providers.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Providers
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) ListProviders(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
providers, err := a.r.ListProviders(ctx)
|
||||
|
|
@ -307,6 +357,13 @@ func (a *APIController) ListProviders(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /jobs jobs ListJobs
|
||||
//
|
||||
// List all jobs.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Jobs
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) ListAllJobs(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
jobs, err := a.r.ListAllJobs(ctx)
|
||||
|
|
|
|||
|
|
@ -19,13 +19,27 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
gErrors "github.com/cloudbase/garm/errors"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route POST /enterprises enterprises CreateEnterprise
|
||||
//
|
||||
// Create enterprise with the given parameters.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Parameters used to create the enterprise.
|
||||
// type: CreateEnterpriseParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Enterprise
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) CreateEnterpriseHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -48,6 +62,13 @@ func (a *APIController) CreateEnterpriseHandler(w http.ResponseWriter, r *http.R
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /enterprises enterprises ListEnterprises
|
||||
//
|
||||
// List all enterprises.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Enterprises
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListEnterprisesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -64,6 +85,20 @@ func (a *APIController) ListEnterprisesHandler(w http.ResponseWriter, r *http.Re
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /enterprises/{enterpriseID} enterprises GetEnterprise
|
||||
//
|
||||
// Get enterprise by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: The ID of the enterprise to fetch.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Enterprise
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) GetEnterpriseByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -93,6 +128,19 @@ func (a *APIController) GetEnterpriseByIDHandler(w http.ResponseWriter, r *http.
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /enterprises/{enterpriseID} enterprises DeleteEnterprise
|
||||
//
|
||||
// Delete enterprise by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: ID of the enterprise to delete.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteEnterpriseHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -120,6 +168,25 @@ func (a *APIController) DeleteEnterpriseHandler(w http.ResponseWriter, r *http.R
|
|||
|
||||
}
|
||||
|
||||
// swagger:route PUT /enterprises/{enterpriseID} enterprises UpdateEnterprise
|
||||
//
|
||||
// Update enterprise with the given parameters.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: The ID of the enterprise to update.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
// + name: Body
|
||||
// description: Parameters used when updating the enterprise.
|
||||
// type: UpdateEntityParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Enterprise
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) UpdateEnterpriseHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -155,6 +222,26 @@ func (a *APIController) UpdateEnterpriseHandler(w http.ResponseWriter, r *http.R
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route POST /enterprises/{enterpriseID}/pools enterprises pools CreateEnterprisePool
|
||||
//
|
||||
// Create enterprise pool with the parameters given.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: Enterprise ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: Body
|
||||
// description: Parameters used when creating the enterprise pool.
|
||||
// type: CreatePoolParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) CreateEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -191,6 +278,20 @@ func (a *APIController) CreateEnterprisePoolHandler(w http.ResponseWriter, r *ht
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /enterprises/{enterpriseID}/pools enterprises pools ListEnterprisePools
|
||||
//
|
||||
// List enterprise pools.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: Enterprise ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pools
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -220,6 +321,26 @@ func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *htt
|
|||
|
||||
}
|
||||
|
||||
// swagger:route GET /enterprises/{enterpriseID}/pools/{poolID} enterprises pools GetEnterprisePool
|
||||
//
|
||||
// Get enterprise pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: Enterprise ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: poolID
|
||||
// description: Pool ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) GetEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -249,6 +370,25 @@ func (a *APIController) GetEnterprisePoolHandler(w http.ResponseWriter, r *http.
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /enterprises/{enterpriseID}/pools/{poolID} enterprises pools DeleteEnterprisePool
|
||||
//
|
||||
// Delete enterprise pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: Enterprise ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: poolID
|
||||
// description: ID of the enterprise pool to delete.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -277,6 +417,32 @@ func (a *APIController) DeleteEnterprisePoolHandler(w http.ResponseWriter, r *ht
|
|||
|
||||
}
|
||||
|
||||
// swagger:route PUT /enterprises/{enterpriseID}/pools/{poolID} enterprises pools UpdateEnterprisePool
|
||||
//
|
||||
// Update enterprise pool with the parameters given.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: Enterprise ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: poolID
|
||||
// description: ID of the enterprise pool to update.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: Body
|
||||
// description: Parameters used when updating the enterprise pool.
|
||||
// type: UpdatePoolParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) UpdateEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,13 +19,27 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
gErrors "github.com/cloudbase/garm/errors"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route GET /pools/{poolID}/instances instances ListPoolInstances
|
||||
//
|
||||
// List runner instances in a pool.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: poolID
|
||||
// description: Runner pool ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Instances
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListPoolInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -176,6 +190,20 @@ func (a *APIController) ListRepoInstancesHandler(w http.ResponseWriter, r *http.
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /organizations/{orgID}/instances organizations instances ListOrgInstances
|
||||
//
|
||||
// List organization instances.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: Organization ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Instances
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListOrgInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -204,6 +232,20 @@ func (a *APIController) ListOrgInstancesHandler(w http.ResponseWriter, r *http.R
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /enterprises/{enterpriseID}/instances enterprises instances ListEnterpriseInstances
|
||||
//
|
||||
// List enterprise instances.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: enterpriseID
|
||||
// description: Enterprise ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Instances
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListEnterpriseInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
|
|||
|
|
@ -19,13 +19,27 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
gErrors "github.com/cloudbase/garm/errors"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route POST /organizations organizations CreateOrg
|
||||
//
|
||||
// Create organization with the parameters given.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Parameters used when creating the organization.
|
||||
// type: CreateOrgParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Organization
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) CreateOrgHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -48,6 +62,13 @@ func (a *APIController) CreateOrgHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /organizations organizations ListOrgs
|
||||
//
|
||||
// List organizations.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Organizations
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListOrgsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -64,6 +85,20 @@ func (a *APIController) ListOrgsHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /organizations/{orgID} organizations GetOrg
|
||||
//
|
||||
// Get organization by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: ID of the organization to fetch.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Organization
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) GetOrgByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -93,6 +128,19 @@ func (a *APIController) GetOrgByIDHandler(w http.ResponseWriter, r *http.Request
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /organizations/{orgID} organizations DeleteOrg
|
||||
//
|
||||
// Delete organization by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: ID of the organization to delete.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteOrgHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -120,6 +168,26 @@ func (a *APIController) DeleteOrgHandler(w http.ResponseWriter, r *http.Request)
|
|||
|
||||
}
|
||||
|
||||
// swagger:route PUT /organizations/{orgID} organizations UpdateOrg
|
||||
//
|
||||
// Update organization with the parameters given.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: ID of the organization to update.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: Body
|
||||
// description: Parameters used when updating the organization.
|
||||
// type: UpdateEntityParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Organization
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) UpdateOrgHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -155,6 +223,26 @@ func (a *APIController) UpdateOrgHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route POST /organizations/{orgID}/pools organizations pools CreateOrgPool
|
||||
//
|
||||
// Create organization pool with the parameters given.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: Organization ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: Body
|
||||
// description: Parameters used when creating the organization pool.
|
||||
// type: CreatePoolParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) CreateOrgPoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -191,6 +279,20 @@ func (a *APIController) CreateOrgPoolHandler(w http.ResponseWriter, r *http.Requ
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /organizations/{orgID}/pools organizations pools ListOrgPools
|
||||
//
|
||||
// List organization pools.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: Organization ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pools
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListOrgPoolsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -219,6 +321,26 @@ func (a *APIController) ListOrgPoolsHandler(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /organizations/{orgID}/pools/{poolID} organizations pools GetOrgPool
|
||||
//
|
||||
// Get organization pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: Organization ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: poolID
|
||||
// description: Pool ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) GetOrgPoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -248,6 +370,25 @@ func (a *APIController) GetOrgPoolHandler(w http.ResponseWriter, r *http.Request
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /organizations/{orgID}/pools/{poolID} organizations pools DeleteOrgPool
|
||||
//
|
||||
// Delete organization pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: Organization ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: poolID
|
||||
// description: ID of the organization pool to delete.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteOrgPoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -276,6 +417,32 @@ func (a *APIController) DeleteOrgPoolHandler(w http.ResponseWriter, r *http.Requ
|
|||
|
||||
}
|
||||
|
||||
// swagger:route PUT /organizations/{orgID}/pools/{poolID} organizations pools UpdateOrgPool
|
||||
//
|
||||
// Update organization pool with the parameters given.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: orgID
|
||||
// description: Organization ID.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: poolID
|
||||
// description: ID of the organization pool to update.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: Body
|
||||
// description: Parameters used when updating the organization pool.
|
||||
// type: UpdatePoolParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) UpdateOrgPoolHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,13 +19,20 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
gErrors "github.com/cloudbase/garm/errors"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route GET /pools pools ListPools
|
||||
//
|
||||
// List all pools.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pools
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListAllPoolsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -43,6 +50,20 @@ func (a *APIController) ListAllPoolsHandler(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /pools/{poolID} pools GetPool
|
||||
//
|
||||
// Get pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: poolID
|
||||
// description: ID of the pool to fetch.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) GetPoolByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -74,6 +95,19 @@ func (a *APIController) GetPoolByIDHandler(w http.ResponseWriter, r *http.Reques
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /pools/{poolID} pools DeletePool
|
||||
//
|
||||
// Delete pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: poolID
|
||||
// description: ID of the pool to delete.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeletePoolByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
@ -100,6 +134,26 @@ func (a *APIController) DeletePoolByIDHandler(w http.ResponseWriter, r *http.Req
|
|||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
// swagger:route PUT /pools/{poolID} pools UpdatePool
|
||||
//
|
||||
// Update pool by ID.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: poolID
|
||||
// description: ID of the pool to update.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// + name: Body
|
||||
// description: Parameters to update the pool with.
|
||||
// type: UpdatePoolParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: Pool
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) UpdatePoolByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
gErrors "github.com/cloudbase/garm/errors"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ import (
|
|||
"github.com/gorilla/mux"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/apiserver/controllers"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/util"
|
||||
)
|
||||
|
||||
func WithMetricsRouter(parentRouter *mux.Router, disableAuth bool, metricsMiddlerware auth.Middleware) *mux.Router {
|
||||
|
|
@ -98,6 +98,7 @@ func NewAPIRouter(han *controllers.APIController, logWriter io.Writer, authMiddl
|
|||
// FirstRunHandler
|
||||
firstRunRouter := apiSubRouter.PathPrefix("/first-run").Subrouter()
|
||||
firstRunRouter.Handle("/", http.HandlerFunc(han.FirstRunHandler)).Methods("POST", "OPTIONS")
|
||||
firstRunRouter.Handle("", http.HandlerFunc(han.FirstRunHandler)).Methods("POST", "OPTIONS")
|
||||
|
||||
// Instance URLs
|
||||
callbackRouter := apiSubRouter.PathPrefix("/callbacks").Subrouter()
|
||||
|
|
@ -219,7 +220,7 @@ func NewAPIRouter(han *controllers.APIController, logWriter io.Writer, authMiddl
|
|||
apiRouter.Handle("/organizations/{orgID}/pools/", http.HandlerFunc(han.CreateOrgPoolHandler)).Methods("POST", "OPTIONS")
|
||||
apiRouter.Handle("/organizations/{orgID}/pools", http.HandlerFunc(han.CreateOrgPoolHandler)).Methods("POST", "OPTIONS")
|
||||
|
||||
// Repo instances list
|
||||
// Org instances list
|
||||
apiRouter.Handle("/organizations/{orgID}/instances/", http.HandlerFunc(han.ListOrgInstancesHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/organizations/{orgID}/instances", http.HandlerFunc(han.ListOrgInstancesHandler)).Methods("GET", "OPTIONS")
|
||||
|
||||
|
|
@ -258,23 +259,23 @@ func NewAPIRouter(han *controllers.APIController, logWriter io.Writer, authMiddl
|
|||
apiRouter.Handle("/enterprises/{enterpriseID}/pools/", http.HandlerFunc(han.CreateEnterprisePoolHandler)).Methods("POST", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}/pools", http.HandlerFunc(han.CreateEnterprisePoolHandler)).Methods("POST", "OPTIONS")
|
||||
|
||||
// Repo instances list
|
||||
// Enterprise instances list
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}/instances/", http.HandlerFunc(han.ListEnterpriseInstancesHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}/instances", http.HandlerFunc(han.ListEnterpriseInstancesHandler)).Methods("GET", "OPTIONS")
|
||||
|
||||
// Get org
|
||||
// Get enterprise
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}/", http.HandlerFunc(han.GetEnterpriseByIDHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}", http.HandlerFunc(han.GetEnterpriseByIDHandler)).Methods("GET", "OPTIONS")
|
||||
// Update org
|
||||
// Update enterprise
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}/", http.HandlerFunc(han.UpdateEnterpriseHandler)).Methods("PUT", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}", http.HandlerFunc(han.UpdateEnterpriseHandler)).Methods("PUT", "OPTIONS")
|
||||
// Delete org
|
||||
// Delete enterprise
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}/", http.HandlerFunc(han.DeleteEnterpriseHandler)).Methods("DELETE", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises/{enterpriseID}", http.HandlerFunc(han.DeleteEnterpriseHandler)).Methods("DELETE", "OPTIONS")
|
||||
// List orgs
|
||||
// List enterprises
|
||||
apiRouter.Handle("/enterprises/", http.HandlerFunc(han.ListEnterprisesHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises", http.HandlerFunc(han.ListEnterprisesHandler)).Methods("GET", "OPTIONS")
|
||||
// Create org
|
||||
// Create enterprise
|
||||
apiRouter.Handle("/enterprises/", http.HandlerFunc(han.CreateEnterpriseHandler)).Methods("POST", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises", http.HandlerFunc(han.CreateEnterpriseHandler)).Methods("POST", "OPTIONS")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,91 @@
|
|||
# NOTE: The purpose of these definitions is to reuse the existing golang
|
||||
# types from GARM packages.
|
||||
definitions:
|
||||
Instances:
|
||||
User:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: User
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
NewUserParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: NewUserParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
PasswordLoginParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: PasswordLoginParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
JWTResponse:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: JWTResponse
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Jobs:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Jobs
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/Job'
|
||||
Job:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: Job
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Credentials:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Credentials
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/GithubCredentials'
|
||||
GithubCredentials:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: GithubCredentials
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Providers:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Providers
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/Provider'
|
||||
Provider:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: Provider
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Instances:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Instances
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/Instance'
|
||||
Instance:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -16,12 +94,14 @@ definitions:
|
|||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Pools:
|
||||
type: object
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Pools
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/Pool'
|
||||
Pool:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -52,6 +132,52 @@ definitions:
|
|||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Organizations:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Organizations
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/Organization'
|
||||
Organization:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: Organization
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
CreateOrgParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: CreateOrgParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
Enterprises:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: Enterprises
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/Enterprise'
|
||||
Enterprise:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: Enterprise
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
CreateEnterpriseParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: CreateEnterpriseParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
UpdateEntityParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,20 @@ definitions:
|
|||
alias: apiserver_params
|
||||
package: github.com/cloudbase/garm/apiserver/params
|
||||
type: APIErrorResponse
|
||||
CreateEnterpriseParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateEnterpriseParams
|
||||
CreateOrgParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateOrgParams
|
||||
CreatePoolParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -23,6 +37,38 @@ definitions:
|
|||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateRepoParams
|
||||
Credentials:
|
||||
items:
|
||||
$ref: '#/definitions/GithubCredentials'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Credentials
|
||||
Enterprise:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Enterprise
|
||||
Enterprises:
|
||||
items:
|
||||
$ref: '#/definitions/Enterprise'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Enterprises
|
||||
GithubCredentials:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: GithubCredentials
|
||||
Instance:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -31,12 +77,67 @@ definitions:
|
|||
package: github.com/cloudbase/garm/params
|
||||
type: Instance
|
||||
Instances:
|
||||
type: object
|
||||
items:
|
||||
$ref: '#/definitions/Instance'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Instances
|
||||
JWTResponse:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: JWTResponse
|
||||
Job:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Job
|
||||
Jobs:
|
||||
items:
|
||||
$ref: '#/definitions/Job'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Jobs
|
||||
NewUserParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: NewUserParams
|
||||
Organization:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Organization
|
||||
Organizations:
|
||||
items:
|
||||
$ref: '#/definitions/Organization'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Organizations
|
||||
PasswordLoginParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: PasswordLoginParams
|
||||
Pool:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -45,12 +146,30 @@ definitions:
|
|||
package: github.com/cloudbase/garm/params
|
||||
type: Pool
|
||||
Pools:
|
||||
type: object
|
||||
items:
|
||||
$ref: '#/definitions/Pool'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Pools
|
||||
Provider:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Provider
|
||||
Providers:
|
||||
items:
|
||||
$ref: '#/definitions/Provider'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Providers
|
||||
Repositories:
|
||||
items:
|
||||
$ref: '#/definitions/Repository'
|
||||
|
|
@ -81,6 +200,13 @@ definitions:
|
|||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: UpdatePoolParams
|
||||
User:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: User
|
||||
info:
|
||||
description: The Garm API generated using go-swagger.
|
||||
license:
|
||||
|
|
@ -89,6 +215,328 @@ info:
|
|||
title: Garm API.
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/auth/login:
|
||||
post:
|
||||
operationId: Login
|
||||
parameters:
|
||||
- description: Login information.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/PasswordLoginParams'
|
||||
description: Login information.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: JWTResponse
|
||||
schema:
|
||||
$ref: '#/definitions/JWTResponse'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Logs in a user and returns a JWT token.
|
||||
tags:
|
||||
- login
|
||||
/credentials:
|
||||
get:
|
||||
operationId: ListCredentials
|
||||
responses:
|
||||
"200":
|
||||
description: Credentials
|
||||
schema:
|
||||
$ref: '#/definitions/Credentials'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all credentials.
|
||||
tags:
|
||||
- credentials
|
||||
/enterprises:
|
||||
get:
|
||||
operationId: ListEnterprises
|
||||
responses:
|
||||
"200":
|
||||
description: Enterprises
|
||||
schema:
|
||||
$ref: '#/definitions/Enterprises'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all enterprises.
|
||||
tags:
|
||||
- enterprises
|
||||
post:
|
||||
operationId: CreateEnterprise
|
||||
parameters:
|
||||
- description: Parameters used to create the enterprise.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/CreateEnterpriseParams'
|
||||
description: Parameters used to create the enterprise.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Enterprise
|
||||
schema:
|
||||
$ref: '#/definitions/Enterprise'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Create enterprise with the given parameters.
|
||||
tags:
|
||||
- enterprises
|
||||
/enterprises/{enterpriseID}:
|
||||
delete:
|
||||
operationId: DeleteEnterprise
|
||||
parameters:
|
||||
- description: ID of the enterprise to delete.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete enterprise by ID.
|
||||
tags:
|
||||
- enterprises
|
||||
get:
|
||||
operationId: GetEnterprise
|
||||
parameters:
|
||||
- description: The ID of the enterprise to fetch.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Enterprise
|
||||
schema:
|
||||
$ref: '#/definitions/Enterprise'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get enterprise by ID.
|
||||
tags:
|
||||
- enterprises
|
||||
put:
|
||||
operationId: UpdateEnterprise
|
||||
parameters:
|
||||
- description: The ID of the enterprise to update.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when updating the enterprise.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdateEntityParams'
|
||||
description: Parameters used when updating the enterprise.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Enterprise
|
||||
schema:
|
||||
$ref: '#/definitions/Enterprise'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update enterprise with the given parameters.
|
||||
tags:
|
||||
- enterprises
|
||||
/enterprises/{enterpriseID}/instances:
|
||||
get:
|
||||
operationId: ListEnterpriseInstances
|
||||
parameters:
|
||||
- description: Enterprise ID.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Instances
|
||||
schema:
|
||||
$ref: '#/definitions/Instances'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List enterprise instances.
|
||||
tags:
|
||||
- enterprises
|
||||
- instances
|
||||
/enterprises/{enterpriseID}/pools:
|
||||
get:
|
||||
operationId: ListEnterprisePools
|
||||
parameters:
|
||||
- description: Enterprise ID.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Pools
|
||||
schema:
|
||||
$ref: '#/definitions/Pools'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List enterprise pools.
|
||||
tags:
|
||||
- enterprises
|
||||
- pools
|
||||
post:
|
||||
operationId: CreateEnterprisePool
|
||||
parameters:
|
||||
- description: Enterprise ID.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when creating the enterprise pool.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/CreatePoolParams'
|
||||
description: Parameters used when creating the enterprise pool.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Create enterprise pool with the parameters given.
|
||||
tags:
|
||||
- enterprises
|
||||
- pools
|
||||
/enterprises/{enterpriseID}/pools/{poolID}:
|
||||
delete:
|
||||
operationId: DeleteEnterprisePool
|
||||
parameters:
|
||||
- description: Enterprise ID.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
- description: ID of the enterprise pool to delete.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete enterprise pool by ID.
|
||||
tags:
|
||||
- enterprises
|
||||
- pools
|
||||
get:
|
||||
operationId: GetEnterprisePool
|
||||
parameters:
|
||||
- description: Enterprise ID.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
- description: Pool ID.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get enterprise pool by ID.
|
||||
tags:
|
||||
- enterprises
|
||||
- pools
|
||||
put:
|
||||
operationId: UpdateEnterprisePool
|
||||
parameters:
|
||||
- description: Enterprise ID.
|
||||
in: path
|
||||
name: enterpriseID
|
||||
required: true
|
||||
type: string
|
||||
- description: ID of the enterprise pool to update.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when updating the enterprise pool.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdatePoolParams'
|
||||
description: Parameters used when updating the enterprise pool.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update enterprise pool with the parameters given.
|
||||
tags:
|
||||
- enterprises
|
||||
- pools
|
||||
/first-run:
|
||||
post:
|
||||
operationId: FirstRun
|
||||
parameters:
|
||||
- description: Create a new user.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/NewUserParams'
|
||||
description: Create a new user.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: User
|
||||
schema:
|
||||
$ref: '#/definitions/User'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Initialize the first run of the controller.
|
||||
tags:
|
||||
- first-run
|
||||
/instances:
|
||||
get:
|
||||
operationId: ListInstances
|
||||
|
|
@ -141,6 +589,411 @@ paths:
|
|||
summary: Get runner instance by name.
|
||||
tags:
|
||||
- instances
|
||||
/jobs:
|
||||
get:
|
||||
operationId: ListJobs
|
||||
responses:
|
||||
"200":
|
||||
description: Jobs
|
||||
schema:
|
||||
$ref: '#/definitions/Jobs'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all jobs.
|
||||
tags:
|
||||
- jobs
|
||||
/metrics-token:
|
||||
get:
|
||||
operationId: GetMetricsToken
|
||||
responses:
|
||||
"200":
|
||||
description: JWTResponse
|
||||
schema:
|
||||
$ref: '#/definitions/JWTResponse'
|
||||
"401":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Returns a JWT token that can be used to access the metrics endpoint.
|
||||
tags:
|
||||
- metrics-token
|
||||
/organizations:
|
||||
get:
|
||||
operationId: ListOrgs
|
||||
responses:
|
||||
"200":
|
||||
description: Organizations
|
||||
schema:
|
||||
$ref: '#/definitions/Organizations'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List organizations.
|
||||
tags:
|
||||
- organizations
|
||||
post:
|
||||
operationId: CreateOrg
|
||||
parameters:
|
||||
- description: Parameters used when creating the organization.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/CreateOrgParams'
|
||||
description: Parameters used when creating the organization.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Organization
|
||||
schema:
|
||||
$ref: '#/definitions/Organization'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Create organization with the parameters given.
|
||||
tags:
|
||||
- organizations
|
||||
/organizations/{orgID}:
|
||||
delete:
|
||||
operationId: DeleteOrg
|
||||
parameters:
|
||||
- description: ID of the organization to delete.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete organization by ID.
|
||||
tags:
|
||||
- organizations
|
||||
get:
|
||||
operationId: GetOrg
|
||||
parameters:
|
||||
- description: ID of the organization to fetch.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Organization
|
||||
schema:
|
||||
$ref: '#/definitions/Organization'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get organization by ID.
|
||||
tags:
|
||||
- organizations
|
||||
put:
|
||||
operationId: UpdateOrg
|
||||
parameters:
|
||||
- description: ID of the organization to update.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when updating the organization.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdateEntityParams'
|
||||
description: Parameters used when updating the organization.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Organization
|
||||
schema:
|
||||
$ref: '#/definitions/Organization'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update organization with the parameters given.
|
||||
tags:
|
||||
- organizations
|
||||
/organizations/{orgID}/instances:
|
||||
get:
|
||||
operationId: ListOrgInstances
|
||||
parameters:
|
||||
- description: Organization ID.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Instances
|
||||
schema:
|
||||
$ref: '#/definitions/Instances'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List organization instances.
|
||||
tags:
|
||||
- organizations
|
||||
- instances
|
||||
/organizations/{orgID}/pools:
|
||||
get:
|
||||
operationId: ListOrgPools
|
||||
parameters:
|
||||
- description: Organization ID.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Pools
|
||||
schema:
|
||||
$ref: '#/definitions/Pools'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List organization pools.
|
||||
tags:
|
||||
- organizations
|
||||
- pools
|
||||
post:
|
||||
operationId: CreateOrgPool
|
||||
parameters:
|
||||
- description: Organization ID.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when creating the organization pool.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/CreatePoolParams'
|
||||
description: Parameters used when creating the organization pool.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Create organization pool with the parameters given.
|
||||
tags:
|
||||
- organizations
|
||||
- pools
|
||||
/organizations/{orgID}/pools/{poolID}:
|
||||
delete:
|
||||
operationId: DeleteOrgPool
|
||||
parameters:
|
||||
- description: Organization ID.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
- description: ID of the organization pool to delete.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete organization pool by ID.
|
||||
tags:
|
||||
- organizations
|
||||
- pools
|
||||
get:
|
||||
operationId: GetOrgPool
|
||||
parameters:
|
||||
- description: Organization ID.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
- description: Pool ID.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get organization pool by ID.
|
||||
tags:
|
||||
- organizations
|
||||
- pools
|
||||
put:
|
||||
operationId: UpdateOrgPool
|
||||
parameters:
|
||||
- description: Organization ID.
|
||||
in: path
|
||||
name: orgID
|
||||
required: true
|
||||
type: string
|
||||
- description: ID of the organization pool to update.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when updating the organization pool.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdatePoolParams'
|
||||
description: Parameters used when updating the organization pool.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update organization pool with the parameters given.
|
||||
tags:
|
||||
- organizations
|
||||
- pools
|
||||
/pools:
|
||||
get:
|
||||
operationId: ListPools
|
||||
responses:
|
||||
"200":
|
||||
description: Pools
|
||||
schema:
|
||||
$ref: '#/definitions/Pools'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all pools.
|
||||
tags:
|
||||
- pools
|
||||
/pools/{poolID}:
|
||||
delete:
|
||||
operationId: DeletePool
|
||||
parameters:
|
||||
- description: ID of the pool to delete.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete pool by ID.
|
||||
tags:
|
||||
- pools
|
||||
get:
|
||||
operationId: GetPool
|
||||
parameters:
|
||||
- description: ID of the pool to fetch.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get pool by ID.
|
||||
tags:
|
||||
- pools
|
||||
put:
|
||||
operationId: UpdatePool
|
||||
parameters:
|
||||
- description: ID of the pool to update.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters to update the pool with.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdatePoolParams'
|
||||
description: Parameters to update the pool with.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: Pool
|
||||
schema:
|
||||
$ref: '#/definitions/Pool'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update pool by ID.
|
||||
tags:
|
||||
- pools
|
||||
/pools/{poolID}/instances:
|
||||
get:
|
||||
operationId: ListPoolInstances
|
||||
parameters:
|
||||
- description: Runner pool ID.
|
||||
in: path
|
||||
name: poolID
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Instances
|
||||
schema:
|
||||
$ref: '#/definitions/Instances'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List runner instances in a pool.
|
||||
tags:
|
||||
- instances
|
||||
/providers:
|
||||
get:
|
||||
operationId: ListProviders
|
||||
responses:
|
||||
"200":
|
||||
description: Providers
|
||||
schema:
|
||||
$ref: '#/definitions/Providers'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all providers.
|
||||
tags:
|
||||
- providers
|
||||
/repositories:
|
||||
get:
|
||||
operationId: ListRepos
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/config"
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
runnerErrors "github.com/cloudbase/garm/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/util"
|
||||
|
||||
"github.com/golang-jwt/jwt"
|
||||
"github.com/nbutton23/zxcvbn-go"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/providers/common"
|
||||
)
|
||||
|
||||
type contextFlags string
|
||||
|
|
@ -65,16 +64,16 @@ func InstanceTokenFetched(ctx context.Context) bool {
|
|||
return elem.(bool)
|
||||
}
|
||||
|
||||
func SetInstanceRunnerStatus(ctx context.Context, val common.RunnerStatus) context.Context {
|
||||
func SetInstanceRunnerStatus(ctx context.Context, val params.RunnerStatus) context.Context {
|
||||
return context.WithValue(ctx, instanceRunnerStatus, val)
|
||||
}
|
||||
|
||||
func InstanceRunnerStatus(ctx context.Context) common.RunnerStatus {
|
||||
func InstanceRunnerStatus(ctx context.Context) params.RunnerStatus {
|
||||
elem := ctx.Value(instanceRunnerStatus)
|
||||
if elem == nil {
|
||||
return common.RunnerPending
|
||||
return params.RunnerPending
|
||||
}
|
||||
return elem.(common.RunnerStatus)
|
||||
return elem.(params.RunnerStatus)
|
||||
}
|
||||
|
||||
func SetInstanceName(ctx context.Context, val string) context.Context {
|
||||
|
|
|
|||
|
|
@ -21,12 +21,11 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/config"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
runnerErrors "github.com/cloudbase/garm/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/common"
|
||||
providerCommon "github.com/cloudbase/garm/runner/providers/common"
|
||||
|
||||
"github.com/golang-jwt/jwt"
|
||||
"github.com/pkg/errors"
|
||||
|
|
@ -149,7 +148,7 @@ func (amw *instanceMiddleware) Middleware(next http.Handler) http.Handler {
|
|||
}
|
||||
|
||||
runnerStatus := InstanceRunnerStatus(ctx)
|
||||
if runnerStatus != providerCommon.RunnerInstalling && runnerStatus != providerCommon.RunnerPending {
|
||||
if runnerStatus != params.RunnerInstalling && runnerStatus != params.RunnerPending {
|
||||
// Instances that have finished installing can no longer authenticate to the API
|
||||
invalidAuthResponse(w)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
apiParams "github.com/cloudbase/garm/apiserver/params"
|
||||
"github.com/cloudbase/garm/config"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
runnerErrors "github.com/cloudbase/garm/errors"
|
||||
|
||||
"github.com/golang-jwt/jwt"
|
||||
)
|
||||
|
|
@ -74,8 +74,8 @@ func (amw *jwtMiddleware) claimsToContext(ctx context.Context, claims *JWTClaims
|
|||
}
|
||||
|
||||
func invalidAuthResponse(w http.ResponseWriter) {
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
if err := json.NewEncoder(w).Encode(
|
||||
apiParams.APIErrorResponse{
|
||||
Error: "Authentication failed",
|
||||
|
|
|
|||
80
client/credentials/credentials_client.go
Normal file
80
client/credentials/credentials_client.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new credentials API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for credentials API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ListCredentials(params *ListCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCredentialsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ListCredentials lists all credentials
|
||||
*/
|
||||
func (a *Client) ListCredentials(params *ListCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCredentialsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListCredentialsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListCredentials",
|
||||
Method: "GET",
|
||||
PathPattern: "/credentials",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListCredentialsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListCredentialsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for ListCredentials: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
128
client/credentials/list_credentials_parameters.go
Normal file
128
client/credentials/list_credentials_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListCredentialsParams creates a new ListCredentialsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListCredentialsParams() *ListCredentialsParams {
|
||||
return &ListCredentialsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCredentialsParamsWithTimeout creates a new ListCredentialsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListCredentialsParamsWithTimeout(timeout time.Duration) *ListCredentialsParams {
|
||||
return &ListCredentialsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCredentialsParamsWithContext creates a new ListCredentialsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListCredentialsParamsWithContext(ctx context.Context) *ListCredentialsParams {
|
||||
return &ListCredentialsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCredentialsParamsWithHTTPClient creates a new ListCredentialsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListCredentialsParamsWithHTTPClient(client *http.Client) *ListCredentialsParams {
|
||||
return &ListCredentialsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListCredentialsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list credentials operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListCredentialsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListCredentialsParams) WithDefaults() *ListCredentialsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListCredentialsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list credentials params
|
||||
func (o *ListCredentialsParams) WithTimeout(timeout time.Duration) *ListCredentialsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list credentials params
|
||||
func (o *ListCredentialsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list credentials params
|
||||
func (o *ListCredentialsParams) WithContext(ctx context.Context) *ListCredentialsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list credentials params
|
||||
func (o *ListCredentialsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list credentials params
|
||||
func (o *ListCredentialsParams) WithHTTPClient(client *http.Client) *ListCredentialsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list credentials params
|
||||
func (o *ListCredentialsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
174
client/credentials/list_credentials_responses.go
Normal file
174
client/credentials/list_credentials_responses.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListCredentialsReader is a Reader for the ListCredentials structure.
|
||||
type ListCredentialsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListCredentialsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewListCredentialsBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /credentials] ListCredentials", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewListCredentialsOK creates a ListCredentialsOK with default headers values
|
||||
func NewListCredentialsOK() *ListCredentialsOK {
|
||||
return &ListCredentialsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListCredentialsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Credentials
|
||||
*/
|
||||
type ListCredentialsOK struct {
|
||||
Payload garm_params.Credentials
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list credentials o k response has a 2xx status code
|
||||
func (o *ListCredentialsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list credentials o k response has a 3xx status code
|
||||
func (o *ListCredentialsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list credentials o k response has a 4xx status code
|
||||
func (o *ListCredentialsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list credentials o k response has a 5xx status code
|
||||
func (o *ListCredentialsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list credentials o k response a status code equal to that given
|
||||
func (o *ListCredentialsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list credentials o k response
|
||||
func (o *ListCredentialsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListCredentialsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsOK) String() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsOK) GetPayload() garm_params.Credentials {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListCredentialsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListCredentialsBadRequest creates a ListCredentialsBadRequest with default headers values
|
||||
func NewListCredentialsBadRequest() *ListCredentialsBadRequest {
|
||||
return &ListCredentialsBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListCredentialsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListCredentialsBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list credentials bad request response has a 2xx status code
|
||||
func (o *ListCredentialsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list credentials bad request response has a 3xx status code
|
||||
func (o *ListCredentialsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list credentials bad request response has a 4xx status code
|
||||
func (o *ListCredentialsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list credentials bad request response has a 5xx status code
|
||||
func (o *ListCredentialsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list credentials bad request response a status code equal to that given
|
||||
func (o *ListCredentialsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the list credentials bad request response
|
||||
func (o *ListCredentialsBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/enterprises/create_enterprise_parameters.go
Normal file
151
client/enterprises/create_enterprise_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewCreateEnterpriseParams creates a new CreateEnterpriseParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateEnterpriseParams() *CreateEnterpriseParams {
|
||||
return &CreateEnterpriseParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterpriseParamsWithTimeout creates a new CreateEnterpriseParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateEnterpriseParamsWithTimeout(timeout time.Duration) *CreateEnterpriseParams {
|
||||
return &CreateEnterpriseParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterpriseParamsWithContext creates a new CreateEnterpriseParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateEnterpriseParamsWithContext(ctx context.Context) *CreateEnterpriseParams {
|
||||
return &CreateEnterpriseParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterpriseParamsWithHTTPClient creates a new CreateEnterpriseParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateEnterpriseParamsWithHTTPClient(client *http.Client) *CreateEnterpriseParams {
|
||||
return &CreateEnterpriseParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterpriseParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the create enterprise operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateEnterpriseParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used to create the enterprise.
|
||||
*/
|
||||
Body garm_params.CreateEnterpriseParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateEnterpriseParams) WithDefaults() *CreateEnterpriseParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateEnterpriseParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) WithTimeout(timeout time.Duration) *CreateEnterpriseParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) WithContext(ctx context.Context) *CreateEnterpriseParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) WithHTTPClient(client *http.Client) *CreateEnterpriseParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) WithBody(body garm_params.CreateEnterpriseParams) *CreateEnterpriseParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create enterprise params
|
||||
func (o *CreateEnterpriseParams) SetBody(body garm_params.CreateEnterpriseParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateEnterpriseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
173
client/enterprises/create_enterprise_pool_parameters.go
Normal file
173
client/enterprises/create_enterprise_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewCreateEnterprisePoolParams creates a new CreateEnterprisePoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateEnterprisePoolParams() *CreateEnterprisePoolParams {
|
||||
return &CreateEnterprisePoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterprisePoolParamsWithTimeout creates a new CreateEnterprisePoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateEnterprisePoolParamsWithTimeout(timeout time.Duration) *CreateEnterprisePoolParams {
|
||||
return &CreateEnterprisePoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterprisePoolParamsWithContext creates a new CreateEnterprisePoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateEnterprisePoolParamsWithContext(ctx context.Context) *CreateEnterprisePoolParams {
|
||||
return &CreateEnterprisePoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterprisePoolParamsWithHTTPClient creates a new CreateEnterprisePoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateEnterprisePoolParamsWithHTTPClient(client *http.Client) *CreateEnterprisePoolParams {
|
||||
return &CreateEnterprisePoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterprisePoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the create enterprise pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateEnterprisePoolParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating the enterprise pool.
|
||||
*/
|
||||
Body garm_params.CreatePoolParams
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
Enterprise ID.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateEnterprisePoolParams) WithDefaults() *CreateEnterprisePoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateEnterprisePoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) WithTimeout(timeout time.Duration) *CreateEnterprisePoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) WithContext(ctx context.Context) *CreateEnterprisePoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) WithHTTPClient(client *http.Client) *CreateEnterprisePoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) WithBody(body garm_params.CreatePoolParams) *CreateEnterprisePoolParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) SetBody(body garm_params.CreatePoolParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *CreateEnterprisePoolParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the create enterprise pool params
|
||||
func (o *CreateEnterprisePoolParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateEnterprisePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/create_enterprise_pool_responses.go
Normal file
179
client/enterprises/create_enterprise_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// CreateEnterprisePoolReader is a Reader for the CreateEnterprisePool structure.
|
||||
type CreateEnterprisePoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewCreateEnterprisePoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewCreateEnterprisePoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterprisePoolOK creates a CreateEnterprisePoolOK with default headers values
|
||||
func NewCreateEnterprisePoolOK() *CreateEnterprisePoolOK {
|
||||
return &CreateEnterprisePoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterprisePoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type CreateEnterprisePoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create enterprise pool o k response has a 2xx status code
|
||||
func (o *CreateEnterprisePoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create enterprise pool o k response has a 3xx status code
|
||||
func (o *CreateEnterprisePoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create enterprise pool o k response has a 4xx status code
|
||||
func (o *CreateEnterprisePoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create enterprise pool o k response has a 5xx status code
|
||||
func (o *CreateEnterprisePoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create enterprise pool o k response a status code equal to that given
|
||||
func (o *CreateEnterprisePoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the create enterprise pool o k response
|
||||
func (o *CreateEnterprisePoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateEnterprisePoolDefault creates a CreateEnterprisePoolDefault with default headers values
|
||||
func NewCreateEnterprisePoolDefault(code int) *CreateEnterprisePoolDefault {
|
||||
return &CreateEnterprisePoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterprisePoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type CreateEnterprisePoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create enterprise pool default response has a 2xx status code
|
||||
func (o *CreateEnterprisePoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create enterprise pool default response has a 3xx status code
|
||||
func (o *CreateEnterprisePoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create enterprise pool default response has a 4xx status code
|
||||
func (o *CreateEnterprisePoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create enterprise pool default response has a 5xx status code
|
||||
func (o *CreateEnterprisePoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this create enterprise pool default response a status code equal to that given
|
||||
func (o *CreateEnterprisePoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the create enterprise pool default response
|
||||
func (o *CreateEnterprisePoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/create_enterprise_responses.go
Normal file
179
client/enterprises/create_enterprise_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// CreateEnterpriseReader is a Reader for the CreateEnterprise structure.
|
||||
type CreateEnterpriseReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewCreateEnterpriseOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewCreateEnterpriseDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateEnterpriseOK creates a CreateEnterpriseOK with default headers values
|
||||
func NewCreateEnterpriseOK() *CreateEnterpriseOK {
|
||||
return &CreateEnterpriseOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterpriseOK describes a response with status code 200, with default header values.
|
||||
|
||||
Enterprise
|
||||
*/
|
||||
type CreateEnterpriseOK struct {
|
||||
Payload garm_params.Enterprise
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create enterprise o k response has a 2xx status code
|
||||
func (o *CreateEnterpriseOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create enterprise o k response has a 3xx status code
|
||||
func (o *CreateEnterpriseOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create enterprise o k response has a 4xx status code
|
||||
func (o *CreateEnterpriseOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create enterprise o k response has a 5xx status code
|
||||
func (o *CreateEnterpriseOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create enterprise o k response a status code equal to that given
|
||||
func (o *CreateEnterpriseOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the create enterprise o k response
|
||||
func (o *CreateEnterpriseOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) GetPayload() garm_params.Enterprise {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateEnterpriseDefault creates a CreateEnterpriseDefault with default headers values
|
||||
func NewCreateEnterpriseDefault(code int) *CreateEnterpriseDefault {
|
||||
return &CreateEnterpriseDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterpriseDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type CreateEnterpriseDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create enterprise default response has a 2xx status code
|
||||
func (o *CreateEnterpriseDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create enterprise default response has a 3xx status code
|
||||
func (o *CreateEnterpriseDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create enterprise default response has a 4xx status code
|
||||
func (o *CreateEnterpriseDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create enterprise default response has a 5xx status code
|
||||
func (o *CreateEnterpriseDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this create enterprise default response a status code equal to that given
|
||||
func (o *CreateEnterpriseDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the create enterprise default response
|
||||
func (o *CreateEnterpriseDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/enterprises/delete_enterprise_parameters.go
Normal file
151
client/enterprises/delete_enterprise_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteEnterpriseParams creates a new DeleteEnterpriseParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteEnterpriseParams() *DeleteEnterpriseParams {
|
||||
return &DeleteEnterpriseParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteEnterpriseParamsWithTimeout creates a new DeleteEnterpriseParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteEnterpriseParamsWithTimeout(timeout time.Duration) *DeleteEnterpriseParams {
|
||||
return &DeleteEnterpriseParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteEnterpriseParamsWithContext creates a new DeleteEnterpriseParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteEnterpriseParamsWithContext(ctx context.Context) *DeleteEnterpriseParams {
|
||||
return &DeleteEnterpriseParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteEnterpriseParamsWithHTTPClient creates a new DeleteEnterpriseParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteEnterpriseParamsWithHTTPClient(client *http.Client) *DeleteEnterpriseParams {
|
||||
return &DeleteEnterpriseParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteEnterpriseParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete enterprise operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteEnterpriseParams struct {
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
ID of the enterprise to delete.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteEnterpriseParams) WithDefaults() *DeleteEnterpriseParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteEnterpriseParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) WithTimeout(timeout time.Duration) *DeleteEnterpriseParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) WithContext(ctx context.Context) *DeleteEnterpriseParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) WithHTTPClient(client *http.Client) *DeleteEnterpriseParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) WithEnterpriseID(enterpriseID string) *DeleteEnterpriseParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the delete enterprise params
|
||||
func (o *DeleteEnterpriseParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteEnterpriseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
173
client/enterprises/delete_enterprise_pool_parameters.go
Normal file
173
client/enterprises/delete_enterprise_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteEnterprisePoolParams creates a new DeleteEnterprisePoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteEnterprisePoolParams() *DeleteEnterprisePoolParams {
|
||||
return &DeleteEnterprisePoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteEnterprisePoolParamsWithTimeout creates a new DeleteEnterprisePoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteEnterprisePoolParamsWithTimeout(timeout time.Duration) *DeleteEnterprisePoolParams {
|
||||
return &DeleteEnterprisePoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteEnterprisePoolParamsWithContext creates a new DeleteEnterprisePoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteEnterprisePoolParamsWithContext(ctx context.Context) *DeleteEnterprisePoolParams {
|
||||
return &DeleteEnterprisePoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteEnterprisePoolParamsWithHTTPClient creates a new DeleteEnterprisePoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteEnterprisePoolParamsWithHTTPClient(client *http.Client) *DeleteEnterprisePoolParams {
|
||||
return &DeleteEnterprisePoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteEnterprisePoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete enterprise pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteEnterprisePoolParams struct {
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
Enterprise ID.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the enterprise pool to delete.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteEnterprisePoolParams) WithDefaults() *DeleteEnterprisePoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteEnterprisePoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) WithTimeout(timeout time.Duration) *DeleteEnterprisePoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) WithContext(ctx context.Context) *DeleteEnterprisePoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) WithHTTPClient(client *http.Client) *DeleteEnterprisePoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *DeleteEnterprisePoolParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) WithPoolID(poolID string) *DeleteEnterprisePoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the delete enterprise pool params
|
||||
func (o *DeleteEnterprisePoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteEnterprisePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
103
client/enterprises/delete_enterprise_pool_responses.go
Normal file
103
client/enterprises/delete_enterprise_pool_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeleteEnterprisePoolReader is a Reader for the DeleteEnterprisePool structure.
|
||||
type DeleteEnterprisePoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeleteEnterprisePoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeleteEnterprisePoolDefault creates a DeleteEnterprisePoolDefault with default headers values
|
||||
func NewDeleteEnterprisePoolDefault(code int) *DeleteEnterprisePoolDefault {
|
||||
return &DeleteEnterprisePoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteEnterprisePoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeleteEnterprisePoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete enterprise pool default response has a 2xx status code
|
||||
func (o *DeleteEnterprisePoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete enterprise pool default response has a 3xx status code
|
||||
func (o *DeleteEnterprisePoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete enterprise pool default response has a 4xx status code
|
||||
func (o *DeleteEnterprisePoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete enterprise pool default response has a 5xx status code
|
||||
func (o *DeleteEnterprisePoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete enterprise pool default response a status code equal to that given
|
||||
func (o *DeleteEnterprisePoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete enterprise pool default response
|
||||
func (o *DeleteEnterprisePoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
103
client/enterprises/delete_enterprise_responses.go
Normal file
103
client/enterprises/delete_enterprise_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeleteEnterpriseReader is a Reader for the DeleteEnterprise structure.
|
||||
type DeleteEnterpriseReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeleteEnterpriseDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeleteEnterpriseDefault creates a DeleteEnterpriseDefault with default headers values
|
||||
func NewDeleteEnterpriseDefault(code int) *DeleteEnterpriseDefault {
|
||||
return &DeleteEnterpriseDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteEnterpriseDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeleteEnterpriseDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete enterprise default response has a 2xx status code
|
||||
func (o *DeleteEnterpriseDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete enterprise default response has a 3xx status code
|
||||
func (o *DeleteEnterpriseDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete enterprise default response has a 4xx status code
|
||||
func (o *DeleteEnterpriseDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete enterprise default response has a 5xx status code
|
||||
func (o *DeleteEnterpriseDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete enterprise default response a status code equal to that given
|
||||
func (o *DeleteEnterpriseDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete enterprise default response
|
||||
func (o *DeleteEnterpriseDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
465
client/enterprises/enterprises_client.go
Normal file
465
client/enterprises/enterprises_client.go
Normal file
|
|
@ -0,0 +1,465 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new enterprises API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for enterprises API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
CreateEnterprise(params *CreateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterpriseOK, error)
|
||||
|
||||
CreateEnterprisePool(params *CreateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterprisePoolOK, error)
|
||||
|
||||
DeleteEnterprise(params *DeleteEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
DeleteEnterprisePool(params *DeleteEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
GetEnterprise(params *GetEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterpriseOK, error)
|
||||
|
||||
GetEnterprisePool(params *GetEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterprisePoolOK, error)
|
||||
|
||||
ListEnterpriseInstances(params *ListEnterpriseInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterpriseInstancesOK, error)
|
||||
|
||||
ListEnterprisePools(params *ListEnterprisePoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisePoolsOK, error)
|
||||
|
||||
ListEnterprises(params *ListEnterprisesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisesOK, error)
|
||||
|
||||
UpdateEnterprise(params *UpdateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterpriseOK, error)
|
||||
|
||||
UpdateEnterprisePool(params *UpdateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterprisePoolOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterprise creates enterprise with the given parameters
|
||||
*/
|
||||
func (a *Client) CreateEnterprise(params *CreateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterpriseOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateEnterpriseParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "CreateEnterprise",
|
||||
Method: "POST",
|
||||
PathPattern: "/enterprises",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateEnterpriseReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateEnterpriseOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*CreateEnterpriseDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
CreateEnterprisePool creates enterprise pool with the parameters given
|
||||
*/
|
||||
func (a *Client) CreateEnterprisePool(params *CreateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterprisePoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateEnterprisePoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "CreateEnterprisePool",
|
||||
Method: "POST",
|
||||
PathPattern: "/enterprises/{enterpriseID}/pools",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateEnterprisePoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateEnterprisePoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*CreateEnterprisePoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteEnterprise deletes enterprise by ID
|
||||
*/
|
||||
func (a *Client) DeleteEnterprise(params *DeleteEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteEnterpriseParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteEnterprise",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/enterprises/{enterpriseID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteEnterpriseReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteEnterprisePool deletes enterprise pool by ID
|
||||
*/
|
||||
func (a *Client) DeleteEnterprisePool(params *DeleteEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteEnterprisePoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteEnterprisePool",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/enterprises/{enterpriseID}/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteEnterprisePoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterprise gets enterprise by ID
|
||||
*/
|
||||
func (a *Client) GetEnterprise(params *GetEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterpriseOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetEnterpriseParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetEnterprise",
|
||||
Method: "GET",
|
||||
PathPattern: "/enterprises/{enterpriseID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetEnterpriseReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetEnterpriseOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*GetEnterpriseDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterprisePool gets enterprise pool by ID
|
||||
*/
|
||||
func (a *Client) GetEnterprisePool(params *GetEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterprisePoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetEnterprisePoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetEnterprisePool",
|
||||
Method: "GET",
|
||||
PathPattern: "/enterprises/{enterpriseID}/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetEnterprisePoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetEnterprisePoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*GetEnterprisePoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterpriseInstances lists enterprise instances
|
||||
*/
|
||||
func (a *Client) ListEnterpriseInstances(params *ListEnterpriseInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterpriseInstancesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListEnterpriseInstancesParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListEnterpriseInstances",
|
||||
Method: "GET",
|
||||
PathPattern: "/enterprises/{enterpriseID}/instances",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListEnterpriseInstancesReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListEnterpriseInstancesOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListEnterpriseInstancesDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisePools lists enterprise pools
|
||||
*/
|
||||
func (a *Client) ListEnterprisePools(params *ListEnterprisePoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisePoolsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListEnterprisePoolsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListEnterprisePools",
|
||||
Method: "GET",
|
||||
PathPattern: "/enterprises/{enterpriseID}/pools",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListEnterprisePoolsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListEnterprisePoolsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListEnterprisePoolsDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprises lists all enterprises
|
||||
*/
|
||||
func (a *Client) ListEnterprises(params *ListEnterprisesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListEnterprisesParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListEnterprises",
|
||||
Method: "GET",
|
||||
PathPattern: "/enterprises",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListEnterprisesReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListEnterprisesOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListEnterprisesDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterprise updates enterprise with the given parameters
|
||||
*/
|
||||
func (a *Client) UpdateEnterprise(params *UpdateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterpriseOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateEnterpriseParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateEnterprise",
|
||||
Method: "PUT",
|
||||
PathPattern: "/enterprises/{enterpriseID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateEnterpriseReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateEnterpriseOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*UpdateEnterpriseDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterprisePool updates enterprise pool with the parameters given
|
||||
*/
|
||||
func (a *Client) UpdateEnterprisePool(params *UpdateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterprisePoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateEnterprisePoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateEnterprisePool",
|
||||
Method: "PUT",
|
||||
PathPattern: "/enterprises/{enterpriseID}/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateEnterprisePoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateEnterprisePoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*UpdateEnterprisePoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
151
client/enterprises/get_enterprise_parameters.go
Normal file
151
client/enterprises/get_enterprise_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetEnterpriseParams creates a new GetEnterpriseParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetEnterpriseParams() *GetEnterpriseParams {
|
||||
return &GetEnterpriseParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterpriseParamsWithTimeout creates a new GetEnterpriseParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetEnterpriseParamsWithTimeout(timeout time.Duration) *GetEnterpriseParams {
|
||||
return &GetEnterpriseParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterpriseParamsWithContext creates a new GetEnterpriseParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetEnterpriseParamsWithContext(ctx context.Context) *GetEnterpriseParams {
|
||||
return &GetEnterpriseParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterpriseParamsWithHTTPClient creates a new GetEnterpriseParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetEnterpriseParamsWithHTTPClient(client *http.Client) *GetEnterpriseParams {
|
||||
return &GetEnterpriseParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterpriseParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get enterprise operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetEnterpriseParams struct {
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
The ID of the enterprise to fetch.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetEnterpriseParams) WithDefaults() *GetEnterpriseParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetEnterpriseParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get enterprise params
|
||||
func (o *GetEnterpriseParams) WithTimeout(timeout time.Duration) *GetEnterpriseParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get enterprise params
|
||||
func (o *GetEnterpriseParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get enterprise params
|
||||
func (o *GetEnterpriseParams) WithContext(ctx context.Context) *GetEnterpriseParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get enterprise params
|
||||
func (o *GetEnterpriseParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get enterprise params
|
||||
func (o *GetEnterpriseParams) WithHTTPClient(client *http.Client) *GetEnterpriseParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get enterprise params
|
||||
func (o *GetEnterpriseParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the get enterprise params
|
||||
func (o *GetEnterpriseParams) WithEnterpriseID(enterpriseID string) *GetEnterpriseParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the get enterprise params
|
||||
func (o *GetEnterpriseParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetEnterpriseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
173
client/enterprises/get_enterprise_pool_parameters.go
Normal file
173
client/enterprises/get_enterprise_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetEnterprisePoolParams creates a new GetEnterprisePoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetEnterprisePoolParams() *GetEnterprisePoolParams {
|
||||
return &GetEnterprisePoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterprisePoolParamsWithTimeout creates a new GetEnterprisePoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetEnterprisePoolParamsWithTimeout(timeout time.Duration) *GetEnterprisePoolParams {
|
||||
return &GetEnterprisePoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterprisePoolParamsWithContext creates a new GetEnterprisePoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetEnterprisePoolParamsWithContext(ctx context.Context) *GetEnterprisePoolParams {
|
||||
return &GetEnterprisePoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterprisePoolParamsWithHTTPClient creates a new GetEnterprisePoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetEnterprisePoolParamsWithHTTPClient(client *http.Client) *GetEnterprisePoolParams {
|
||||
return &GetEnterprisePoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterprisePoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get enterprise pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetEnterprisePoolParams struct {
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
Enterprise ID.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
/* PoolID.
|
||||
|
||||
Pool ID.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetEnterprisePoolParams) WithDefaults() *GetEnterprisePoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetEnterprisePoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) WithTimeout(timeout time.Duration) *GetEnterprisePoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) WithContext(ctx context.Context) *GetEnterprisePoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) WithHTTPClient(client *http.Client) *GetEnterprisePoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *GetEnterprisePoolParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) WithPoolID(poolID string) *GetEnterprisePoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the get enterprise pool params
|
||||
func (o *GetEnterprisePoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetEnterprisePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/get_enterprise_pool_responses.go
Normal file
179
client/enterprises/get_enterprise_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetEnterprisePoolReader is a Reader for the GetEnterprisePool structure.
|
||||
type GetEnterprisePoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetEnterprisePoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewGetEnterprisePoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterprisePoolOK creates a GetEnterprisePoolOK with default headers values
|
||||
func NewGetEnterprisePoolOK() *GetEnterprisePoolOK {
|
||||
return &GetEnterprisePoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterprisePoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type GetEnterprisePoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get enterprise pool o k response has a 2xx status code
|
||||
func (o *GetEnterprisePoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get enterprise pool o k response has a 3xx status code
|
||||
func (o *GetEnterprisePoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get enterprise pool o k response has a 4xx status code
|
||||
func (o *GetEnterprisePoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get enterprise pool o k response has a 5xx status code
|
||||
func (o *GetEnterprisePoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get enterprise pool o k response a status code equal to that given
|
||||
func (o *GetEnterprisePoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get enterprise pool o k response
|
||||
func (o *GetEnterprisePoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetEnterprisePoolDefault creates a GetEnterprisePoolDefault with default headers values
|
||||
func NewGetEnterprisePoolDefault(code int) *GetEnterprisePoolDefault {
|
||||
return &GetEnterprisePoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterprisePoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetEnterprisePoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get enterprise pool default response has a 2xx status code
|
||||
func (o *GetEnterprisePoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get enterprise pool default response has a 3xx status code
|
||||
func (o *GetEnterprisePoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get enterprise pool default response has a 4xx status code
|
||||
func (o *GetEnterprisePoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get enterprise pool default response has a 5xx status code
|
||||
func (o *GetEnterprisePoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this get enterprise pool default response a status code equal to that given
|
||||
func (o *GetEnterprisePoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the get enterprise pool default response
|
||||
func (o *GetEnterprisePoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/get_enterprise_responses.go
Normal file
179
client/enterprises/get_enterprise_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetEnterpriseReader is a Reader for the GetEnterprise structure.
|
||||
type GetEnterpriseReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetEnterpriseOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewGetEnterpriseDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetEnterpriseOK creates a GetEnterpriseOK with default headers values
|
||||
func NewGetEnterpriseOK() *GetEnterpriseOK {
|
||||
return &GetEnterpriseOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterpriseOK describes a response with status code 200, with default header values.
|
||||
|
||||
Enterprise
|
||||
*/
|
||||
type GetEnterpriseOK struct {
|
||||
Payload garm_params.Enterprise
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get enterprise o k response has a 2xx status code
|
||||
func (o *GetEnterpriseOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get enterprise o k response has a 3xx status code
|
||||
func (o *GetEnterpriseOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get enterprise o k response has a 4xx status code
|
||||
func (o *GetEnterpriseOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get enterprise o k response has a 5xx status code
|
||||
func (o *GetEnterpriseOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get enterprise o k response a status code equal to that given
|
||||
func (o *GetEnterpriseOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get enterprise o k response
|
||||
func (o *GetEnterpriseOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseOK) GetPayload() garm_params.Enterprise {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetEnterpriseDefault creates a GetEnterpriseDefault with default headers values
|
||||
func NewGetEnterpriseDefault(code int) *GetEnterpriseDefault {
|
||||
return &GetEnterpriseDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetEnterpriseDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetEnterpriseDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get enterprise default response has a 2xx status code
|
||||
func (o *GetEnterpriseDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get enterprise default response has a 3xx status code
|
||||
func (o *GetEnterpriseDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get enterprise default response has a 4xx status code
|
||||
func (o *GetEnterpriseDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get enterprise default response has a 5xx status code
|
||||
func (o *GetEnterpriseDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this get enterprise default response a status code equal to that given
|
||||
func (o *GetEnterpriseDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the get enterprise default response
|
||||
func (o *GetEnterpriseDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/enterprises/list_enterprise_instances_parameters.go
Normal file
151
client/enterprises/list_enterprise_instances_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListEnterpriseInstancesParams creates a new ListEnterpriseInstancesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListEnterpriseInstancesParams() *ListEnterpriseInstancesParams {
|
||||
return &ListEnterpriseInstancesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterpriseInstancesParamsWithTimeout creates a new ListEnterpriseInstancesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListEnterpriseInstancesParamsWithTimeout(timeout time.Duration) *ListEnterpriseInstancesParams {
|
||||
return &ListEnterpriseInstancesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterpriseInstancesParamsWithContext creates a new ListEnterpriseInstancesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListEnterpriseInstancesParamsWithContext(ctx context.Context) *ListEnterpriseInstancesParams {
|
||||
return &ListEnterpriseInstancesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterpriseInstancesParamsWithHTTPClient creates a new ListEnterpriseInstancesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListEnterpriseInstancesParamsWithHTTPClient(client *http.Client) *ListEnterpriseInstancesParams {
|
||||
return &ListEnterpriseInstancesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterpriseInstancesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list enterprise instances operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListEnterpriseInstancesParams struct {
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
Enterprise ID.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list enterprise instances params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnterpriseInstancesParams) WithDefaults() *ListEnterpriseInstancesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list enterprise instances params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnterpriseInstancesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) WithTimeout(timeout time.Duration) *ListEnterpriseInstancesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) WithContext(ctx context.Context) *ListEnterpriseInstancesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) WithHTTPClient(client *http.Client) *ListEnterpriseInstancesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) WithEnterpriseID(enterpriseID string) *ListEnterpriseInstancesParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the list enterprise instances params
|
||||
func (o *ListEnterpriseInstancesParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListEnterpriseInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/list_enterprise_instances_responses.go
Normal file
179
client/enterprises/list_enterprise_instances_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListEnterpriseInstancesReader is a Reader for the ListEnterpriseInstances structure.
|
||||
type ListEnterpriseInstancesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListEnterpriseInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListEnterpriseInstancesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListEnterpriseInstancesDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterpriseInstancesOK creates a ListEnterpriseInstancesOK with default headers values
|
||||
func NewListEnterpriseInstancesOK() *ListEnterpriseInstancesOK {
|
||||
return &ListEnterpriseInstancesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterpriseInstancesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Instances
|
||||
*/
|
||||
type ListEnterpriseInstancesOK struct {
|
||||
Payload garm_params.Instances
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list enterprise instances o k response has a 2xx status code
|
||||
func (o *ListEnterpriseInstancesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list enterprise instances o k response has a 3xx status code
|
||||
func (o *ListEnterpriseInstancesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list enterprise instances o k response has a 4xx status code
|
||||
func (o *ListEnterpriseInstancesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list enterprise instances o k response has a 5xx status code
|
||||
func (o *ListEnterpriseInstancesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list enterprise instances o k response a status code equal to that given
|
||||
func (o *ListEnterpriseInstancesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list enterprise instances o k response
|
||||
func (o *ListEnterpriseInstancesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) GetPayload() garm_params.Instances {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListEnterpriseInstancesDefault creates a ListEnterpriseInstancesDefault with default headers values
|
||||
func NewListEnterpriseInstancesDefault(code int) *ListEnterpriseInstancesDefault {
|
||||
return &ListEnterpriseInstancesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterpriseInstancesDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListEnterpriseInstancesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list enterprise instances default response has a 2xx status code
|
||||
func (o *ListEnterpriseInstancesDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list enterprise instances default response has a 3xx status code
|
||||
func (o *ListEnterpriseInstancesDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list enterprise instances default response has a 4xx status code
|
||||
func (o *ListEnterpriseInstancesDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list enterprise instances default response has a 5xx status code
|
||||
func (o *ListEnterpriseInstancesDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list enterprise instances default response a status code equal to that given
|
||||
func (o *ListEnterpriseInstancesDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list enterprise instances default response
|
||||
func (o *ListEnterpriseInstancesDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/enterprises/list_enterprise_pools_parameters.go
Normal file
151
client/enterprises/list_enterprise_pools_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListEnterprisePoolsParams creates a new ListEnterprisePoolsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListEnterprisePoolsParams() *ListEnterprisePoolsParams {
|
||||
return &ListEnterprisePoolsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisePoolsParamsWithTimeout creates a new ListEnterprisePoolsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListEnterprisePoolsParamsWithTimeout(timeout time.Duration) *ListEnterprisePoolsParams {
|
||||
return &ListEnterprisePoolsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisePoolsParamsWithContext creates a new ListEnterprisePoolsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListEnterprisePoolsParamsWithContext(ctx context.Context) *ListEnterprisePoolsParams {
|
||||
return &ListEnterprisePoolsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisePoolsParamsWithHTTPClient creates a new ListEnterprisePoolsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListEnterprisePoolsParamsWithHTTPClient(client *http.Client) *ListEnterprisePoolsParams {
|
||||
return &ListEnterprisePoolsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisePoolsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list enterprise pools operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListEnterprisePoolsParams struct {
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
Enterprise ID.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list enterprise pools params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnterprisePoolsParams) WithDefaults() *ListEnterprisePoolsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list enterprise pools params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnterprisePoolsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) WithTimeout(timeout time.Duration) *ListEnterprisePoolsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) WithContext(ctx context.Context) *ListEnterprisePoolsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) WithHTTPClient(client *http.Client) *ListEnterprisePoolsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) WithEnterpriseID(enterpriseID string) *ListEnterprisePoolsParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the list enterprise pools params
|
||||
func (o *ListEnterprisePoolsParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListEnterprisePoolsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/list_enterprise_pools_responses.go
Normal file
179
client/enterprises/list_enterprise_pools_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListEnterprisePoolsReader is a Reader for the ListEnterprisePools structure.
|
||||
type ListEnterprisePoolsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListEnterprisePoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListEnterprisePoolsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListEnterprisePoolsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisePoolsOK creates a ListEnterprisePoolsOK with default headers values
|
||||
func NewListEnterprisePoolsOK() *ListEnterprisePoolsOK {
|
||||
return &ListEnterprisePoolsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisePoolsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pools
|
||||
*/
|
||||
type ListEnterprisePoolsOK struct {
|
||||
Payload garm_params.Pools
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list enterprise pools o k response has a 2xx status code
|
||||
func (o *ListEnterprisePoolsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list enterprise pools o k response has a 3xx status code
|
||||
func (o *ListEnterprisePoolsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list enterprise pools o k response has a 4xx status code
|
||||
func (o *ListEnterprisePoolsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list enterprise pools o k response has a 5xx status code
|
||||
func (o *ListEnterprisePoolsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list enterprise pools o k response a status code equal to that given
|
||||
func (o *ListEnterprisePoolsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list enterprise pools o k response
|
||||
func (o *ListEnterprisePoolsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) GetPayload() garm_params.Pools {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListEnterprisePoolsDefault creates a ListEnterprisePoolsDefault with default headers values
|
||||
func NewListEnterprisePoolsDefault(code int) *ListEnterprisePoolsDefault {
|
||||
return &ListEnterprisePoolsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisePoolsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListEnterprisePoolsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list enterprise pools default response has a 2xx status code
|
||||
func (o *ListEnterprisePoolsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list enterprise pools default response has a 3xx status code
|
||||
func (o *ListEnterprisePoolsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list enterprise pools default response has a 4xx status code
|
||||
func (o *ListEnterprisePoolsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list enterprise pools default response has a 5xx status code
|
||||
func (o *ListEnterprisePoolsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list enterprise pools default response a status code equal to that given
|
||||
func (o *ListEnterprisePoolsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list enterprise pools default response
|
||||
func (o *ListEnterprisePoolsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
128
client/enterprises/list_enterprises_parameters.go
Normal file
128
client/enterprises/list_enterprises_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListEnterprisesParams creates a new ListEnterprisesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListEnterprisesParams() *ListEnterprisesParams {
|
||||
return &ListEnterprisesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisesParamsWithTimeout creates a new ListEnterprisesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListEnterprisesParamsWithTimeout(timeout time.Duration) *ListEnterprisesParams {
|
||||
return &ListEnterprisesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisesParamsWithContext creates a new ListEnterprisesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListEnterprisesParamsWithContext(ctx context.Context) *ListEnterprisesParams {
|
||||
return &ListEnterprisesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisesParamsWithHTTPClient creates a new ListEnterprisesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListEnterprisesParamsWithHTTPClient(client *http.Client) *ListEnterprisesParams {
|
||||
return &ListEnterprisesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list enterprises operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListEnterprisesParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list enterprises params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnterprisesParams) WithDefaults() *ListEnterprisesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list enterprises params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnterprisesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list enterprises params
|
||||
func (o *ListEnterprisesParams) WithTimeout(timeout time.Duration) *ListEnterprisesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list enterprises params
|
||||
func (o *ListEnterprisesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list enterprises params
|
||||
func (o *ListEnterprisesParams) WithContext(ctx context.Context) *ListEnterprisesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list enterprises params
|
||||
func (o *ListEnterprisesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list enterprises params
|
||||
func (o *ListEnterprisesParams) WithHTTPClient(client *http.Client) *ListEnterprisesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list enterprises params
|
||||
func (o *ListEnterprisesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListEnterprisesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/list_enterprises_responses.go
Normal file
179
client/enterprises/list_enterprises_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListEnterprisesReader is a Reader for the ListEnterprises structure.
|
||||
type ListEnterprisesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListEnterprisesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListEnterprisesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListEnterprisesDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnterprisesOK creates a ListEnterprisesOK with default headers values
|
||||
func NewListEnterprisesOK() *ListEnterprisesOK {
|
||||
return &ListEnterprisesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Enterprises
|
||||
*/
|
||||
type ListEnterprisesOK struct {
|
||||
Payload garm_params.Enterprises
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list enterprises o k response has a 2xx status code
|
||||
func (o *ListEnterprisesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list enterprises o k response has a 3xx status code
|
||||
func (o *ListEnterprisesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list enterprises o k response has a 4xx status code
|
||||
func (o *ListEnterprisesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list enterprises o k response has a 5xx status code
|
||||
func (o *ListEnterprisesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list enterprises o k response a status code equal to that given
|
||||
func (o *ListEnterprisesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list enterprises o k response
|
||||
func (o *ListEnterprisesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesOK) GetPayload() garm_params.Enterprises {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListEnterprisesDefault creates a ListEnterprisesDefault with default headers values
|
||||
func NewListEnterprisesDefault(code int) *ListEnterprisesDefault {
|
||||
return &ListEnterprisesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnterprisesDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListEnterprisesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list enterprises default response has a 2xx status code
|
||||
func (o *ListEnterprisesDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list enterprises default response has a 3xx status code
|
||||
func (o *ListEnterprisesDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list enterprises default response has a 4xx status code
|
||||
func (o *ListEnterprisesDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list enterprises default response has a 5xx status code
|
||||
func (o *ListEnterprisesDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list enterprises default response a status code equal to that given
|
||||
func (o *ListEnterprisesDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list enterprises default response
|
||||
func (o *ListEnterprisesDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
173
client/enterprises/update_enterprise_parameters.go
Normal file
173
client/enterprises/update_enterprise_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateEnterpriseParams creates a new UpdateEnterpriseParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateEnterpriseParams() *UpdateEnterpriseParams {
|
||||
return &UpdateEnterpriseParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterpriseParamsWithTimeout creates a new UpdateEnterpriseParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateEnterpriseParamsWithTimeout(timeout time.Duration) *UpdateEnterpriseParams {
|
||||
return &UpdateEnterpriseParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterpriseParamsWithContext creates a new UpdateEnterpriseParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateEnterpriseParamsWithContext(ctx context.Context) *UpdateEnterpriseParams {
|
||||
return &UpdateEnterpriseParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterpriseParamsWithHTTPClient creates a new UpdateEnterpriseParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateEnterpriseParamsWithHTTPClient(client *http.Client) *UpdateEnterpriseParams {
|
||||
return &UpdateEnterpriseParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterpriseParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update enterprise operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateEnterpriseParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating the enterprise.
|
||||
*/
|
||||
Body garm_params.UpdateEntityParams
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
The ID of the enterprise to update.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateEnterpriseParams) WithDefaults() *UpdateEnterpriseParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update enterprise params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateEnterpriseParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) WithTimeout(timeout time.Duration) *UpdateEnterpriseParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) WithContext(ctx context.Context) *UpdateEnterpriseParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) WithHTTPClient(client *http.Client) *UpdateEnterpriseParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) WithBody(body garm_params.UpdateEntityParams) *UpdateEnterpriseParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) SetBody(body garm_params.UpdateEntityParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) WithEnterpriseID(enterpriseID string) *UpdateEnterpriseParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the update enterprise params
|
||||
func (o *UpdateEnterpriseParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateEnterpriseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
195
client/enterprises/update_enterprise_pool_parameters.go
Normal file
195
client/enterprises/update_enterprise_pool_parameters.go
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateEnterprisePoolParams creates a new UpdateEnterprisePoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateEnterprisePoolParams() *UpdateEnterprisePoolParams {
|
||||
return &UpdateEnterprisePoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterprisePoolParamsWithTimeout creates a new UpdateEnterprisePoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateEnterprisePoolParamsWithTimeout(timeout time.Duration) *UpdateEnterprisePoolParams {
|
||||
return &UpdateEnterprisePoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterprisePoolParamsWithContext creates a new UpdateEnterprisePoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateEnterprisePoolParamsWithContext(ctx context.Context) *UpdateEnterprisePoolParams {
|
||||
return &UpdateEnterprisePoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterprisePoolParamsWithHTTPClient creates a new UpdateEnterprisePoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateEnterprisePoolParamsWithHTTPClient(client *http.Client) *UpdateEnterprisePoolParams {
|
||||
return &UpdateEnterprisePoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterprisePoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update enterprise pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateEnterprisePoolParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating the enterprise pool.
|
||||
*/
|
||||
Body garm_params.UpdatePoolParams
|
||||
|
||||
/* EnterpriseID.
|
||||
|
||||
Enterprise ID.
|
||||
*/
|
||||
EnterpriseID string
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the enterprise pool to update.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateEnterprisePoolParams) WithDefaults() *UpdateEnterprisePoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update enterprise pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateEnterprisePoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) WithTimeout(timeout time.Duration) *UpdateEnterprisePoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) WithContext(ctx context.Context) *UpdateEnterprisePoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) WithHTTPClient(client *http.Client) *UpdateEnterprisePoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) WithBody(body garm_params.UpdatePoolParams) *UpdateEnterprisePoolParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) SetBody(body garm_params.UpdatePoolParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithEnterpriseID adds the enterpriseID to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *UpdateEnterprisePoolParams {
|
||||
o.SetEnterpriseID(enterpriseID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnterpriseID adds the enterpriseId to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) SetEnterpriseID(enterpriseID string) {
|
||||
o.EnterpriseID = enterpriseID
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) WithPoolID(poolID string) *UpdateEnterprisePoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the update enterprise pool params
|
||||
func (o *UpdateEnterprisePoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateEnterprisePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param enterpriseID
|
||||
if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/update_enterprise_pool_responses.go
Normal file
179
client/enterprises/update_enterprise_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateEnterprisePoolReader is a Reader for the UpdateEnterprisePool structure.
|
||||
type UpdateEnterprisePoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateEnterprisePoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewUpdateEnterprisePoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterprisePoolOK creates a UpdateEnterprisePoolOK with default headers values
|
||||
func NewUpdateEnterprisePoolOK() *UpdateEnterprisePoolOK {
|
||||
return &UpdateEnterprisePoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterprisePoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type UpdateEnterprisePoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update enterprise pool o k response has a 2xx status code
|
||||
func (o *UpdateEnterprisePoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update enterprise pool o k response has a 3xx status code
|
||||
func (o *UpdateEnterprisePoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update enterprise pool o k response has a 4xx status code
|
||||
func (o *UpdateEnterprisePoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update enterprise pool o k response has a 5xx status code
|
||||
func (o *UpdateEnterprisePoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update enterprise pool o k response a status code equal to that given
|
||||
func (o *UpdateEnterprisePoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update enterprise pool o k response
|
||||
func (o *UpdateEnterprisePoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateEnterprisePoolDefault creates a UpdateEnterprisePoolDefault with default headers values
|
||||
func NewUpdateEnterprisePoolDefault(code int) *UpdateEnterprisePoolDefault {
|
||||
return &UpdateEnterprisePoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterprisePoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateEnterprisePoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update enterprise pool default response has a 2xx status code
|
||||
func (o *UpdateEnterprisePoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update enterprise pool default response has a 3xx status code
|
||||
func (o *UpdateEnterprisePoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update enterprise pool default response has a 4xx status code
|
||||
func (o *UpdateEnterprisePoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update enterprise pool default response has a 5xx status code
|
||||
func (o *UpdateEnterprisePoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this update enterprise pool default response a status code equal to that given
|
||||
func (o *UpdateEnterprisePoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the update enterprise pool default response
|
||||
func (o *UpdateEnterprisePoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
179
client/enterprises/update_enterprise_responses.go
Normal file
179
client/enterprises/update_enterprise_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package enterprises
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateEnterpriseReader is a Reader for the UpdateEnterprise structure.
|
||||
type UpdateEnterpriseReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateEnterpriseOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewUpdateEnterpriseDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateEnterpriseOK creates a UpdateEnterpriseOK with default headers values
|
||||
func NewUpdateEnterpriseOK() *UpdateEnterpriseOK {
|
||||
return &UpdateEnterpriseOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterpriseOK describes a response with status code 200, with default header values.
|
||||
|
||||
Enterprise
|
||||
*/
|
||||
type UpdateEnterpriseOK struct {
|
||||
Payload garm_params.Enterprise
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update enterprise o k response has a 2xx status code
|
||||
func (o *UpdateEnterpriseOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update enterprise o k response has a 3xx status code
|
||||
func (o *UpdateEnterpriseOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update enterprise o k response has a 4xx status code
|
||||
func (o *UpdateEnterpriseOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update enterprise o k response has a 5xx status code
|
||||
func (o *UpdateEnterpriseOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update enterprise o k response a status code equal to that given
|
||||
func (o *UpdateEnterpriseOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update enterprise o k response
|
||||
func (o *UpdateEnterpriseOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) GetPayload() garm_params.Enterprise {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateEnterpriseDefault creates a UpdateEnterpriseDefault with default headers values
|
||||
func NewUpdateEnterpriseDefault(code int) *UpdateEnterpriseDefault {
|
||||
return &UpdateEnterpriseDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateEnterpriseDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateEnterpriseDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update enterprise default response has a 2xx status code
|
||||
func (o *UpdateEnterpriseDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update enterprise default response has a 3xx status code
|
||||
func (o *UpdateEnterpriseDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update enterprise default response has a 4xx status code
|
||||
func (o *UpdateEnterpriseDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update enterprise default response has a 5xx status code
|
||||
func (o *UpdateEnterpriseDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this update enterprise default response a status code equal to that given
|
||||
func (o *UpdateEnterpriseDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the update enterprise default response
|
||||
func (o *UpdateEnterpriseDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
80
client/first_run/first_run_client.go
Normal file
80
client/first_run/first_run_client.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package first_run
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new first run API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for first run API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
FirstRun(params *FirstRunParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FirstRunOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
FirstRun initializes the first run of the controller
|
||||
*/
|
||||
func (a *Client) FirstRun(params *FirstRunParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FirstRunOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewFirstRunParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "FirstRun",
|
||||
Method: "POST",
|
||||
PathPattern: "/first-run",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &FirstRunReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*FirstRunOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for FirstRun: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
151
client/first_run/first_run_parameters.go
Normal file
151
client/first_run/first_run_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package first_run
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewFirstRunParams creates a new FirstRunParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewFirstRunParams() *FirstRunParams {
|
||||
return &FirstRunParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewFirstRunParamsWithTimeout creates a new FirstRunParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewFirstRunParamsWithTimeout(timeout time.Duration) *FirstRunParams {
|
||||
return &FirstRunParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewFirstRunParamsWithContext creates a new FirstRunParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewFirstRunParamsWithContext(ctx context.Context) *FirstRunParams {
|
||||
return &FirstRunParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewFirstRunParamsWithHTTPClient creates a new FirstRunParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewFirstRunParamsWithHTTPClient(client *http.Client) *FirstRunParams {
|
||||
return &FirstRunParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
FirstRunParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the first run operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type FirstRunParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Create a new user.
|
||||
*/
|
||||
Body garm_params.NewUserParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the first run params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *FirstRunParams) WithDefaults() *FirstRunParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the first run params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *FirstRunParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the first run params
|
||||
func (o *FirstRunParams) WithTimeout(timeout time.Duration) *FirstRunParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the first run params
|
||||
func (o *FirstRunParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the first run params
|
||||
func (o *FirstRunParams) WithContext(ctx context.Context) *FirstRunParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the first run params
|
||||
func (o *FirstRunParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the first run params
|
||||
func (o *FirstRunParams) WithHTTPClient(client *http.Client) *FirstRunParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the first run params
|
||||
func (o *FirstRunParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the first run params
|
||||
func (o *FirstRunParams) WithBody(body garm_params.NewUserParams) *FirstRunParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the first run params
|
||||
func (o *FirstRunParams) SetBody(body garm_params.NewUserParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *FirstRunParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
174
client/first_run/first_run_responses.go
Normal file
174
client/first_run/first_run_responses.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package first_run
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// FirstRunReader is a Reader for the FirstRun structure.
|
||||
type FirstRunReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *FirstRunReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewFirstRunOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewFirstRunBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /first-run] FirstRun", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewFirstRunOK creates a FirstRunOK with default headers values
|
||||
func NewFirstRunOK() *FirstRunOK {
|
||||
return &FirstRunOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
FirstRunOK describes a response with status code 200, with default header values.
|
||||
|
||||
User
|
||||
*/
|
||||
type FirstRunOK struct {
|
||||
Payload garm_params.User
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this first run o k response has a 2xx status code
|
||||
func (o *FirstRunOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this first run o k response has a 3xx status code
|
||||
func (o *FirstRunOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this first run o k response has a 4xx status code
|
||||
func (o *FirstRunOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this first run o k response has a 5xx status code
|
||||
func (o *FirstRunOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this first run o k response a status code equal to that given
|
||||
func (o *FirstRunOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the first run o k response
|
||||
func (o *FirstRunOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *FirstRunOK) Error() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunOK) String() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunOK) GetPayload() garm_params.User {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *FirstRunOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewFirstRunBadRequest creates a FirstRunBadRequest with default headers values
|
||||
func NewFirstRunBadRequest() *FirstRunBadRequest {
|
||||
return &FirstRunBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
FirstRunBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type FirstRunBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this first run bad request response has a 2xx status code
|
||||
func (o *FirstRunBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this first run bad request response has a 3xx status code
|
||||
func (o *FirstRunBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this first run bad request response has a 4xx status code
|
||||
func (o *FirstRunBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this first run bad request response has a 5xx status code
|
||||
func (o *FirstRunBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this first run bad request response a status code equal to that given
|
||||
func (o *FirstRunBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the first run bad request response
|
||||
func (o *FirstRunBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *FirstRunBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *FirstRunBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -10,7 +10,16 @@ import (
|
|||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/cloudbase/garm/client/credentials"
|
||||
"github.com/cloudbase/garm/client/enterprises"
|
||||
"github.com/cloudbase/garm/client/first_run"
|
||||
"github.com/cloudbase/garm/client/instances"
|
||||
"github.com/cloudbase/garm/client/jobs"
|
||||
"github.com/cloudbase/garm/client/login"
|
||||
"github.com/cloudbase/garm/client/metrics_token"
|
||||
"github.com/cloudbase/garm/client/organizations"
|
||||
"github.com/cloudbase/garm/client/pools"
|
||||
"github.com/cloudbase/garm/client/providers"
|
||||
"github.com/cloudbase/garm/client/repositories"
|
||||
)
|
||||
|
||||
|
|
@ -56,7 +65,16 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI {
|
|||
|
||||
cli := new(GarmAPI)
|
||||
cli.Transport = transport
|
||||
cli.Credentials = credentials.New(transport, formats)
|
||||
cli.Enterprises = enterprises.New(transport, formats)
|
||||
cli.FirstRun = first_run.New(transport, formats)
|
||||
cli.Instances = instances.New(transport, formats)
|
||||
cli.Jobs = jobs.New(transport, formats)
|
||||
cli.Login = login.New(transport, formats)
|
||||
cli.MetricsToken = metrics_token.New(transport, formats)
|
||||
cli.Organizations = organizations.New(transport, formats)
|
||||
cli.Pools = pools.New(transport, formats)
|
||||
cli.Providers = providers.New(transport, formats)
|
||||
cli.Repositories = repositories.New(transport, formats)
|
||||
return cli
|
||||
}
|
||||
|
|
@ -102,8 +120,26 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
|||
|
||||
// GarmAPI is a client for garm API
|
||||
type GarmAPI struct {
|
||||
Credentials credentials.ClientService
|
||||
|
||||
Enterprises enterprises.ClientService
|
||||
|
||||
FirstRun first_run.ClientService
|
||||
|
||||
Instances instances.ClientService
|
||||
|
||||
Jobs jobs.ClientService
|
||||
|
||||
Login login.ClientService
|
||||
|
||||
MetricsToken metrics_token.ClientService
|
||||
|
||||
Organizations organizations.ClientService
|
||||
|
||||
Pools pools.ClientService
|
||||
|
||||
Providers providers.ClientService
|
||||
|
||||
Repositories repositories.ClientService
|
||||
|
||||
Transport runtime.ClientTransport
|
||||
|
|
@ -112,6 +148,15 @@ type GarmAPI struct {
|
|||
// SetTransport changes the transport on the client and all its subresources
|
||||
func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) {
|
||||
c.Transport = transport
|
||||
c.Credentials.SetTransport(transport)
|
||||
c.Enterprises.SetTransport(transport)
|
||||
c.FirstRun.SetTransport(transport)
|
||||
c.Instances.SetTransport(transport)
|
||||
c.Jobs.SetTransport(transport)
|
||||
c.Login.SetTransport(transport)
|
||||
c.MetricsToken.SetTransport(transport)
|
||||
c.Organizations.SetTransport(transport)
|
||||
c.Pools.SetTransport(transport)
|
||||
c.Providers.SetTransport(transport)
|
||||
c.Repositories.SetTransport(transport)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ type ClientService interface {
|
|||
|
||||
ListInstances(params *ListInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListInstancesOK, error)
|
||||
|
||||
ListPoolInstances(params *ListPoolInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPoolInstancesOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
|
|
@ -145,6 +147,44 @@ func (a *Client) ListInstances(params *ListInstancesParams, authInfo runtime.Cli
|
|||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolInstances lists runner instances in a pool
|
||||
*/
|
||||
func (a *Client) ListPoolInstances(params *ListPoolInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPoolInstancesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListPoolInstancesParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListPoolInstances",
|
||||
Method: "GET",
|
||||
PathPattern: "/pools/{poolID}/instances",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListPoolInstancesReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListPoolInstancesOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListPoolInstancesDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
|
|
|
|||
151
client/instances/list_pool_instances_parameters.go
Normal file
151
client/instances/list_pool_instances_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package instances
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListPoolInstancesParams creates a new ListPoolInstancesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListPoolInstancesParams() *ListPoolInstancesParams {
|
||||
return &ListPoolInstancesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolInstancesParamsWithTimeout creates a new ListPoolInstancesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListPoolInstancesParamsWithTimeout(timeout time.Duration) *ListPoolInstancesParams {
|
||||
return &ListPoolInstancesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolInstancesParamsWithContext creates a new ListPoolInstancesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListPoolInstancesParamsWithContext(ctx context.Context) *ListPoolInstancesParams {
|
||||
return &ListPoolInstancesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolInstancesParamsWithHTTPClient creates a new ListPoolInstancesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListPoolInstancesParamsWithHTTPClient(client *http.Client) *ListPoolInstancesParams {
|
||||
return &ListPoolInstancesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolInstancesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list pool instances operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListPoolInstancesParams struct {
|
||||
|
||||
/* PoolID.
|
||||
|
||||
Runner pool ID.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list pool instances params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListPoolInstancesParams) WithDefaults() *ListPoolInstancesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list pool instances params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListPoolInstancesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) WithTimeout(timeout time.Duration) *ListPoolInstancesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) WithContext(ctx context.Context) *ListPoolInstancesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) WithHTTPClient(client *http.Client) *ListPoolInstancesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) WithPoolID(poolID string) *ListPoolInstancesParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the list pool instances params
|
||||
func (o *ListPoolInstancesParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListPoolInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/instances/list_pool_instances_responses.go
Normal file
179
client/instances/list_pool_instances_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package instances
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListPoolInstancesReader is a Reader for the ListPoolInstances structure.
|
||||
type ListPoolInstancesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListPoolInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListPoolInstancesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListPoolInstancesDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolInstancesOK creates a ListPoolInstancesOK with default headers values
|
||||
func NewListPoolInstancesOK() *ListPoolInstancesOK {
|
||||
return &ListPoolInstancesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolInstancesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Instances
|
||||
*/
|
||||
type ListPoolInstancesOK struct {
|
||||
Payload garm_params.Instances
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list pool instances o k response has a 2xx status code
|
||||
func (o *ListPoolInstancesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list pool instances o k response has a 3xx status code
|
||||
func (o *ListPoolInstancesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list pool instances o k response has a 4xx status code
|
||||
func (o *ListPoolInstancesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list pool instances o k response has a 5xx status code
|
||||
func (o *ListPoolInstancesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list pool instances o k response a status code equal to that given
|
||||
func (o *ListPoolInstancesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list pool instances o k response
|
||||
func (o *ListPoolInstancesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] listPoolInstancesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] listPoolInstancesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) GetPayload() garm_params.Instances {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListPoolInstancesDefault creates a ListPoolInstancesDefault with default headers values
|
||||
func NewListPoolInstancesDefault(code int) *ListPoolInstancesDefault {
|
||||
return &ListPoolInstancesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolInstancesDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListPoolInstancesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list pool instances default response has a 2xx status code
|
||||
func (o *ListPoolInstancesDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list pool instances default response has a 3xx status code
|
||||
func (o *ListPoolInstancesDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list pool instances default response has a 4xx status code
|
||||
func (o *ListPoolInstancesDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list pool instances default response has a 5xx status code
|
||||
func (o *ListPoolInstancesDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list pool instances default response a status code equal to that given
|
||||
func (o *ListPoolInstancesDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list pool instances default response
|
||||
func (o *ListPoolInstancesDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] ListPoolInstances default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] ListPoolInstances default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
80
client/jobs/jobs_client.go
Normal file
80
client/jobs/jobs_client.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package jobs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new jobs API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for jobs API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ListJobs(params *ListJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListJobsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ListJobs lists all jobs
|
||||
*/
|
||||
func (a *Client) ListJobs(params *ListJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListJobsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListJobsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListJobs",
|
||||
Method: "GET",
|
||||
PathPattern: "/jobs",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListJobsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListJobsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for ListJobs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
128
client/jobs/list_jobs_parameters.go
Normal file
128
client/jobs/list_jobs_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package jobs
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListJobsParams creates a new ListJobsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListJobsParams() *ListJobsParams {
|
||||
return &ListJobsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListJobsParamsWithTimeout creates a new ListJobsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListJobsParamsWithTimeout(timeout time.Duration) *ListJobsParams {
|
||||
return &ListJobsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListJobsParamsWithContext creates a new ListJobsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListJobsParamsWithContext(ctx context.Context) *ListJobsParams {
|
||||
return &ListJobsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListJobsParamsWithHTTPClient creates a new ListJobsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListJobsParamsWithHTTPClient(client *http.Client) *ListJobsParams {
|
||||
return &ListJobsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListJobsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list jobs operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListJobsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list jobs params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListJobsParams) WithDefaults() *ListJobsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list jobs params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListJobsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list jobs params
|
||||
func (o *ListJobsParams) WithTimeout(timeout time.Duration) *ListJobsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list jobs params
|
||||
func (o *ListJobsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list jobs params
|
||||
func (o *ListJobsParams) WithContext(ctx context.Context) *ListJobsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list jobs params
|
||||
func (o *ListJobsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list jobs params
|
||||
func (o *ListJobsParams) WithHTTPClient(client *http.Client) *ListJobsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list jobs params
|
||||
func (o *ListJobsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
174
client/jobs/list_jobs_responses.go
Normal file
174
client/jobs/list_jobs_responses.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package jobs
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListJobsReader is a Reader for the ListJobs structure.
|
||||
type ListJobsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListJobsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListJobsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewListJobsBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /jobs] ListJobs", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewListJobsOK creates a ListJobsOK with default headers values
|
||||
func NewListJobsOK() *ListJobsOK {
|
||||
return &ListJobsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListJobsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Jobs
|
||||
*/
|
||||
type ListJobsOK struct {
|
||||
Payload garm_params.Jobs
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list jobs o k response has a 2xx status code
|
||||
func (o *ListJobsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list jobs o k response has a 3xx status code
|
||||
func (o *ListJobsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list jobs o k response has a 4xx status code
|
||||
func (o *ListJobsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list jobs o k response has a 5xx status code
|
||||
func (o *ListJobsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list jobs o k response a status code equal to that given
|
||||
func (o *ListJobsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list jobs o k response
|
||||
func (o *ListJobsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListJobsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsOK) String() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsOK) GetPayload() garm_params.Jobs {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListJobsBadRequest creates a ListJobsBadRequest with default headers values
|
||||
func NewListJobsBadRequest() *ListJobsBadRequest {
|
||||
return &ListJobsBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListJobsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListJobsBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list jobs bad request response has a 2xx status code
|
||||
func (o *ListJobsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list jobs bad request response has a 3xx status code
|
||||
func (o *ListJobsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list jobs bad request response has a 4xx status code
|
||||
func (o *ListJobsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list jobs bad request response has a 5xx status code
|
||||
func (o *ListJobsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list jobs bad request response a status code equal to that given
|
||||
func (o *ListJobsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the list jobs bad request response
|
||||
func (o *ListJobsBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *ListJobsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListJobsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
80
client/login/login_client.go
Normal file
80
client/login/login_client.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package login
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new login API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for login API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
Login(params *LoginParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LoginOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
Login logs in a user and returns a j w t token
|
||||
*/
|
||||
func (a *Client) Login(params *LoginParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LoginOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewLoginParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "Login",
|
||||
Method: "POST",
|
||||
PathPattern: "/auth/login",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &LoginReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*LoginOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for Login: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
151
client/login/login_parameters.go
Normal file
151
client/login/login_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package login
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewLoginParams creates a new LoginParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewLoginParams() *LoginParams {
|
||||
return &LoginParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoginParamsWithTimeout creates a new LoginParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewLoginParamsWithTimeout(timeout time.Duration) *LoginParams {
|
||||
return &LoginParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoginParamsWithContext creates a new LoginParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewLoginParamsWithContext(ctx context.Context) *LoginParams {
|
||||
return &LoginParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoginParamsWithHTTPClient creates a new LoginParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewLoginParamsWithHTTPClient(client *http.Client) *LoginParams {
|
||||
return &LoginParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
LoginParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the login operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type LoginParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Login information.
|
||||
*/
|
||||
Body garm_params.PasswordLoginParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the login params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *LoginParams) WithDefaults() *LoginParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the login params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *LoginParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the login params
|
||||
func (o *LoginParams) WithTimeout(timeout time.Duration) *LoginParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the login params
|
||||
func (o *LoginParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the login params
|
||||
func (o *LoginParams) WithContext(ctx context.Context) *LoginParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the login params
|
||||
func (o *LoginParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the login params
|
||||
func (o *LoginParams) WithHTTPClient(client *http.Client) *LoginParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the login params
|
||||
func (o *LoginParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the login params
|
||||
func (o *LoginParams) WithBody(body garm_params.PasswordLoginParams) *LoginParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the login params
|
||||
func (o *LoginParams) SetBody(body garm_params.PasswordLoginParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *LoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
174
client/login/login_responses.go
Normal file
174
client/login/login_responses.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package login
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// LoginReader is a Reader for the Login structure.
|
||||
type LoginReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *LoginReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewLoginOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewLoginBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /auth/login] Login", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoginOK creates a LoginOK with default headers values
|
||||
func NewLoginOK() *LoginOK {
|
||||
return &LoginOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
LoginOK describes a response with status code 200, with default header values.
|
||||
|
||||
JWTResponse
|
||||
*/
|
||||
type LoginOK struct {
|
||||
Payload garm_params.JWTResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this login o k response has a 2xx status code
|
||||
func (o *LoginOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this login o k response has a 3xx status code
|
||||
func (o *LoginOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this login o k response has a 4xx status code
|
||||
func (o *LoginOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this login o k response has a 5xx status code
|
||||
func (o *LoginOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this login o k response a status code equal to that given
|
||||
func (o *LoginOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the login o k response
|
||||
func (o *LoginOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *LoginOK) Error() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoginOK) String() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoginOK) GetPayload() garm_params.JWTResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *LoginOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewLoginBadRequest creates a LoginBadRequest with default headers values
|
||||
func NewLoginBadRequest() *LoginBadRequest {
|
||||
return &LoginBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
LoginBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type LoginBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this login bad request response has a 2xx status code
|
||||
func (o *LoginBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this login bad request response has a 3xx status code
|
||||
func (o *LoginBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this login bad request response has a 4xx status code
|
||||
func (o *LoginBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this login bad request response has a 5xx status code
|
||||
func (o *LoginBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this login bad request response a status code equal to that given
|
||||
func (o *LoginBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the login bad request response
|
||||
func (o *LoginBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *LoginBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoginBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoginBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *LoginBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
128
client/metrics_token/get_metrics_token_parameters.go
Normal file
128
client/metrics_token/get_metrics_token_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metrics_token
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetMetricsTokenParams creates a new GetMetricsTokenParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetMetricsTokenParams() *GetMetricsTokenParams {
|
||||
return &GetMetricsTokenParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetMetricsTokenParamsWithTimeout creates a new GetMetricsTokenParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetMetricsTokenParamsWithTimeout(timeout time.Duration) *GetMetricsTokenParams {
|
||||
return &GetMetricsTokenParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetMetricsTokenParamsWithContext creates a new GetMetricsTokenParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetMetricsTokenParamsWithContext(ctx context.Context) *GetMetricsTokenParams {
|
||||
return &GetMetricsTokenParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetMetricsTokenParamsWithHTTPClient creates a new GetMetricsTokenParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetMetricsTokenParamsWithHTTPClient(client *http.Client) *GetMetricsTokenParams {
|
||||
return &GetMetricsTokenParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetMetricsTokenParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get metrics token operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetMetricsTokenParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get metrics token params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetMetricsTokenParams) WithDefaults() *GetMetricsTokenParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get metrics token params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetMetricsTokenParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get metrics token params
|
||||
func (o *GetMetricsTokenParams) WithTimeout(timeout time.Duration) *GetMetricsTokenParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get metrics token params
|
||||
func (o *GetMetricsTokenParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get metrics token params
|
||||
func (o *GetMetricsTokenParams) WithContext(ctx context.Context) *GetMetricsTokenParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get metrics token params
|
||||
func (o *GetMetricsTokenParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get metrics token params
|
||||
func (o *GetMetricsTokenParams) WithHTTPClient(client *http.Client) *GetMetricsTokenParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get metrics token params
|
||||
func (o *GetMetricsTokenParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetMetricsTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
174
client/metrics_token/get_metrics_token_responses.go
Normal file
174
client/metrics_token/get_metrics_token_responses.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metrics_token
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetMetricsTokenReader is a Reader for the GetMetricsToken structure.
|
||||
type GetMetricsTokenReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetMetricsTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetMetricsTokenOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewGetMetricsTokenUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /metrics-token] GetMetricsToken", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetMetricsTokenOK creates a GetMetricsTokenOK with default headers values
|
||||
func NewGetMetricsTokenOK() *GetMetricsTokenOK {
|
||||
return &GetMetricsTokenOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetMetricsTokenOK describes a response with status code 200, with default header values.
|
||||
|
||||
JWTResponse
|
||||
*/
|
||||
type GetMetricsTokenOK struct {
|
||||
Payload garm_params.JWTResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get metrics token o k response has a 2xx status code
|
||||
func (o *GetMetricsTokenOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get metrics token o k response has a 3xx status code
|
||||
func (o *GetMetricsTokenOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get metrics token o k response has a 4xx status code
|
||||
func (o *GetMetricsTokenOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get metrics token o k response has a 5xx status code
|
||||
func (o *GetMetricsTokenOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get metrics token o k response a status code equal to that given
|
||||
func (o *GetMetricsTokenOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get metrics token o k response
|
||||
func (o *GetMetricsTokenOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) Error() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) String() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) GetPayload() garm_params.JWTResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetMetricsTokenUnauthorized creates a GetMetricsTokenUnauthorized with default headers values
|
||||
func NewGetMetricsTokenUnauthorized() *GetMetricsTokenUnauthorized {
|
||||
return &GetMetricsTokenUnauthorized{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetMetricsTokenUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetMetricsTokenUnauthorized struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get metrics token unauthorized response has a 2xx status code
|
||||
func (o *GetMetricsTokenUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get metrics token unauthorized response has a 3xx status code
|
||||
func (o *GetMetricsTokenUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get metrics token unauthorized response has a 4xx status code
|
||||
func (o *GetMetricsTokenUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get metrics token unauthorized response has a 5xx status code
|
||||
func (o *GetMetricsTokenUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get metrics token unauthorized response a status code equal to that given
|
||||
func (o *GetMetricsTokenUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the get metrics token unauthorized response
|
||||
func (o *GetMetricsTokenUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) String() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenUnauthorized %+v", 401, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
80
client/metrics_token/metrics_token_client.go
Normal file
80
client/metrics_token/metrics_token_client.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metrics_token
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new metrics token API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for metrics token API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetMetricsToken(params *GetMetricsTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMetricsTokenOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetMetricsToken returns a j w t token that can be used to access the metrics endpoint
|
||||
*/
|
||||
func (a *Client) GetMetricsToken(params *GetMetricsTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMetricsTokenOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetMetricsTokenParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetMetricsToken",
|
||||
Method: "GET",
|
||||
PathPattern: "/metrics-token",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetMetricsTokenReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetMetricsTokenOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for GetMetricsToken: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
151
client/organizations/create_org_parameters.go
Normal file
151
client/organizations/create_org_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewCreateOrgParams creates a new CreateOrgParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateOrgParams() *CreateOrgParams {
|
||||
return &CreateOrgParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgParamsWithTimeout creates a new CreateOrgParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateOrgParamsWithTimeout(timeout time.Duration) *CreateOrgParams {
|
||||
return &CreateOrgParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgParamsWithContext creates a new CreateOrgParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateOrgParamsWithContext(ctx context.Context) *CreateOrgParams {
|
||||
return &CreateOrgParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgParamsWithHTTPClient creates a new CreateOrgParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateOrgParamsWithHTTPClient(client *http.Client) *CreateOrgParams {
|
||||
return &CreateOrgParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the create org operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateOrgParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating the organization.
|
||||
*/
|
||||
Body garm_params.CreateOrgParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateOrgParams) WithDefaults() *CreateOrgParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateOrgParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create org params
|
||||
func (o *CreateOrgParams) WithTimeout(timeout time.Duration) *CreateOrgParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create org params
|
||||
func (o *CreateOrgParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create org params
|
||||
func (o *CreateOrgParams) WithContext(ctx context.Context) *CreateOrgParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create org params
|
||||
func (o *CreateOrgParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create org params
|
||||
func (o *CreateOrgParams) WithHTTPClient(client *http.Client) *CreateOrgParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create org params
|
||||
func (o *CreateOrgParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create org params
|
||||
func (o *CreateOrgParams) WithBody(body garm_params.CreateOrgParams) *CreateOrgParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create org params
|
||||
func (o *CreateOrgParams) SetBody(body garm_params.CreateOrgParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateOrgParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
173
client/organizations/create_org_pool_parameters.go
Normal file
173
client/organizations/create_org_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewCreateOrgPoolParams creates a new CreateOrgPoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateOrgPoolParams() *CreateOrgPoolParams {
|
||||
return &CreateOrgPoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgPoolParamsWithTimeout creates a new CreateOrgPoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateOrgPoolParamsWithTimeout(timeout time.Duration) *CreateOrgPoolParams {
|
||||
return &CreateOrgPoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgPoolParamsWithContext creates a new CreateOrgPoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateOrgPoolParamsWithContext(ctx context.Context) *CreateOrgPoolParams {
|
||||
return &CreateOrgPoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgPoolParamsWithHTTPClient creates a new CreateOrgPoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateOrgPoolParamsWithHTTPClient(client *http.Client) *CreateOrgPoolParams {
|
||||
return &CreateOrgPoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgPoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the create org pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateOrgPoolParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating the organization pool.
|
||||
*/
|
||||
Body garm_params.CreatePoolParams
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateOrgPoolParams) WithDefaults() *CreateOrgPoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateOrgPoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create org pool params
|
||||
func (o *CreateOrgPoolParams) WithTimeout(timeout time.Duration) *CreateOrgPoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create org pool params
|
||||
func (o *CreateOrgPoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create org pool params
|
||||
func (o *CreateOrgPoolParams) WithContext(ctx context.Context) *CreateOrgPoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create org pool params
|
||||
func (o *CreateOrgPoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create org pool params
|
||||
func (o *CreateOrgPoolParams) WithHTTPClient(client *http.Client) *CreateOrgPoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create org pool params
|
||||
func (o *CreateOrgPoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create org pool params
|
||||
func (o *CreateOrgPoolParams) WithBody(body garm_params.CreatePoolParams) *CreateOrgPoolParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create org pool params
|
||||
func (o *CreateOrgPoolParams) SetBody(body garm_params.CreatePoolParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the create org pool params
|
||||
func (o *CreateOrgPoolParams) WithOrgID(orgID string) *CreateOrgPoolParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the create org pool params
|
||||
func (o *CreateOrgPoolParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateOrgPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/create_org_pool_responses.go
Normal file
179
client/organizations/create_org_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// CreateOrgPoolReader is a Reader for the CreateOrgPool structure.
|
||||
type CreateOrgPoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateOrgPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewCreateOrgPoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewCreateOrgPoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgPoolOK creates a CreateOrgPoolOK with default headers values
|
||||
func NewCreateOrgPoolOK() *CreateOrgPoolOK {
|
||||
return &CreateOrgPoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgPoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type CreateOrgPoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create org pool o k response has a 2xx status code
|
||||
func (o *CreateOrgPoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create org pool o k response has a 3xx status code
|
||||
func (o *CreateOrgPoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create org pool o k response has a 4xx status code
|
||||
func (o *CreateOrgPoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create org pool o k response has a 5xx status code
|
||||
func (o *CreateOrgPoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create org pool o k response a status code equal to that given
|
||||
func (o *CreateOrgPoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the create org pool o k response
|
||||
func (o *CreateOrgPoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] createOrgPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] createOrgPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateOrgPoolDefault creates a CreateOrgPoolDefault with default headers values
|
||||
func NewCreateOrgPoolDefault(code int) *CreateOrgPoolDefault {
|
||||
return &CreateOrgPoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgPoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type CreateOrgPoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create org pool default response has a 2xx status code
|
||||
func (o *CreateOrgPoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create org pool default response has a 3xx status code
|
||||
func (o *CreateOrgPoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create org pool default response has a 4xx status code
|
||||
func (o *CreateOrgPoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create org pool default response has a 5xx status code
|
||||
func (o *CreateOrgPoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this create org pool default response a status code equal to that given
|
||||
func (o *CreateOrgPoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the create org pool default response
|
||||
func (o *CreateOrgPoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] CreateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] CreateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/create_org_responses.go
Normal file
179
client/organizations/create_org_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// CreateOrgReader is a Reader for the CreateOrg structure.
|
||||
type CreateOrgReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewCreateOrgOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewCreateOrgDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateOrgOK creates a CreateOrgOK with default headers values
|
||||
func NewCreateOrgOK() *CreateOrgOK {
|
||||
return &CreateOrgOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgOK describes a response with status code 200, with default header values.
|
||||
|
||||
Organization
|
||||
*/
|
||||
type CreateOrgOK struct {
|
||||
Payload garm_params.Organization
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create org o k response has a 2xx status code
|
||||
func (o *CreateOrgOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create org o k response has a 3xx status code
|
||||
func (o *CreateOrgOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create org o k response has a 4xx status code
|
||||
func (o *CreateOrgOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create org o k response has a 5xx status code
|
||||
func (o *CreateOrgOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create org o k response a status code equal to that given
|
||||
func (o *CreateOrgOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the create org o k response
|
||||
func (o *CreateOrgOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *CreateOrgOK) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] createOrgOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgOK) String() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] createOrgOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgOK) GetPayload() garm_params.Organization {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateOrgOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateOrgDefault creates a CreateOrgDefault with default headers values
|
||||
func NewCreateOrgDefault(code int) *CreateOrgDefault {
|
||||
return &CreateOrgDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type CreateOrgDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create org default response has a 2xx status code
|
||||
func (o *CreateOrgDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create org default response has a 3xx status code
|
||||
func (o *CreateOrgDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create org default response has a 4xx status code
|
||||
func (o *CreateOrgDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create org default response has a 5xx status code
|
||||
func (o *CreateOrgDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this create org default response a status code equal to that given
|
||||
func (o *CreateOrgDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the create org default response
|
||||
func (o *CreateOrgDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *CreateOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] CreateOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgDefault) String() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] CreateOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateOrgDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/organizations/delete_org_parameters.go
Normal file
151
client/organizations/delete_org_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteOrgParams creates a new DeleteOrgParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteOrgParams() *DeleteOrgParams {
|
||||
return &DeleteOrgParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteOrgParamsWithTimeout creates a new DeleteOrgParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteOrgParamsWithTimeout(timeout time.Duration) *DeleteOrgParams {
|
||||
return &DeleteOrgParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteOrgParamsWithContext creates a new DeleteOrgParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteOrgParamsWithContext(ctx context.Context) *DeleteOrgParams {
|
||||
return &DeleteOrgParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteOrgParamsWithHTTPClient creates a new DeleteOrgParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteOrgParamsWithHTTPClient(client *http.Client) *DeleteOrgParams {
|
||||
return &DeleteOrgParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrgParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete org operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteOrgParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
ID of the organization to delete.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteOrgParams) WithDefaults() *DeleteOrgParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteOrgParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete org params
|
||||
func (o *DeleteOrgParams) WithTimeout(timeout time.Duration) *DeleteOrgParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete org params
|
||||
func (o *DeleteOrgParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete org params
|
||||
func (o *DeleteOrgParams) WithContext(ctx context.Context) *DeleteOrgParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete org params
|
||||
func (o *DeleteOrgParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete org params
|
||||
func (o *DeleteOrgParams) WithHTTPClient(client *http.Client) *DeleteOrgParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete org params
|
||||
func (o *DeleteOrgParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the delete org params
|
||||
func (o *DeleteOrgParams) WithOrgID(orgID string) *DeleteOrgParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the delete org params
|
||||
func (o *DeleteOrgParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteOrgParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
173
client/organizations/delete_org_pool_parameters.go
Normal file
173
client/organizations/delete_org_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteOrgPoolParams creates a new DeleteOrgPoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteOrgPoolParams() *DeleteOrgPoolParams {
|
||||
return &DeleteOrgPoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteOrgPoolParamsWithTimeout creates a new DeleteOrgPoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteOrgPoolParamsWithTimeout(timeout time.Duration) *DeleteOrgPoolParams {
|
||||
return &DeleteOrgPoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteOrgPoolParamsWithContext creates a new DeleteOrgPoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteOrgPoolParamsWithContext(ctx context.Context) *DeleteOrgPoolParams {
|
||||
return &DeleteOrgPoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteOrgPoolParamsWithHTTPClient creates a new DeleteOrgPoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteOrgPoolParamsWithHTTPClient(client *http.Client) *DeleteOrgPoolParams {
|
||||
return &DeleteOrgPoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrgPoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete org pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteOrgPoolParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the organization pool to delete.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteOrgPoolParams) WithDefaults() *DeleteOrgPoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteOrgPoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) WithTimeout(timeout time.Duration) *DeleteOrgPoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) WithContext(ctx context.Context) *DeleteOrgPoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) WithHTTPClient(client *http.Client) *DeleteOrgPoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) WithOrgID(orgID string) *DeleteOrgPoolParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) WithPoolID(poolID string) *DeleteOrgPoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the delete org pool params
|
||||
func (o *DeleteOrgPoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteOrgPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
103
client/organizations/delete_org_pool_responses.go
Normal file
103
client/organizations/delete_org_pool_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeleteOrgPoolReader is a Reader for the DeleteOrgPool structure.
|
||||
type DeleteOrgPoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteOrgPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeleteOrgPoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeleteOrgPoolDefault creates a DeleteOrgPoolDefault with default headers values
|
||||
func NewDeleteOrgPoolDefault(code int) *DeleteOrgPoolDefault {
|
||||
return &DeleteOrgPoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrgPoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeleteOrgPoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete org pool default response has a 2xx status code
|
||||
func (o *DeleteOrgPoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete org pool default response has a 3xx status code
|
||||
func (o *DeleteOrgPoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete org pool default response has a 4xx status code
|
||||
func (o *DeleteOrgPoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete org pool default response has a 5xx status code
|
||||
func (o *DeleteOrgPoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete org pool default response a status code equal to that given
|
||||
func (o *DeleteOrgPoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete org pool default response
|
||||
func (o *DeleteOrgPoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/pools/{poolID}][%d] DeleteOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/pools/{poolID}][%d] DeleteOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
103
client/organizations/delete_org_responses.go
Normal file
103
client/organizations/delete_org_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeleteOrgReader is a Reader for the DeleteOrg structure.
|
||||
type DeleteOrgReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeleteOrgDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeleteOrgDefault creates a DeleteOrgDefault with default headers values
|
||||
func NewDeleteOrgDefault(code int) *DeleteOrgDefault {
|
||||
return &DeleteOrgDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrgDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeleteOrgDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete org default response has a 2xx status code
|
||||
func (o *DeleteOrgDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete org default response has a 3xx status code
|
||||
func (o *DeleteOrgDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete org default response has a 4xx status code
|
||||
func (o *DeleteOrgDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete org default response has a 5xx status code
|
||||
func (o *DeleteOrgDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete org default response a status code equal to that given
|
||||
func (o *DeleteOrgDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete org default response
|
||||
func (o *DeleteOrgDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeleteOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}][%d] DeleteOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}][%d] DeleteOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeleteOrgDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/organizations/get_org_parameters.go
Normal file
151
client/organizations/get_org_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetOrgParams creates a new GetOrgParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetOrgParams() *GetOrgParams {
|
||||
return &GetOrgParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgParamsWithTimeout creates a new GetOrgParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetOrgParamsWithTimeout(timeout time.Duration) *GetOrgParams {
|
||||
return &GetOrgParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgParamsWithContext creates a new GetOrgParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetOrgParamsWithContext(ctx context.Context) *GetOrgParams {
|
||||
return &GetOrgParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgParamsWithHTTPClient creates a new GetOrgParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetOrgParamsWithHTTPClient(client *http.Client) *GetOrgParams {
|
||||
return &GetOrgParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get org operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetOrgParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
ID of the organization to fetch.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetOrgParams) WithDefaults() *GetOrgParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetOrgParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get org params
|
||||
func (o *GetOrgParams) WithTimeout(timeout time.Duration) *GetOrgParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get org params
|
||||
func (o *GetOrgParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get org params
|
||||
func (o *GetOrgParams) WithContext(ctx context.Context) *GetOrgParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get org params
|
||||
func (o *GetOrgParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get org params
|
||||
func (o *GetOrgParams) WithHTTPClient(client *http.Client) *GetOrgParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get org params
|
||||
func (o *GetOrgParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the get org params
|
||||
func (o *GetOrgParams) WithOrgID(orgID string) *GetOrgParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the get org params
|
||||
func (o *GetOrgParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetOrgParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
173
client/organizations/get_org_pool_parameters.go
Normal file
173
client/organizations/get_org_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetOrgPoolParams creates a new GetOrgPoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetOrgPoolParams() *GetOrgPoolParams {
|
||||
return &GetOrgPoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgPoolParamsWithTimeout creates a new GetOrgPoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetOrgPoolParamsWithTimeout(timeout time.Duration) *GetOrgPoolParams {
|
||||
return &GetOrgPoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgPoolParamsWithContext creates a new GetOrgPoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetOrgPoolParamsWithContext(ctx context.Context) *GetOrgPoolParams {
|
||||
return &GetOrgPoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgPoolParamsWithHTTPClient creates a new GetOrgPoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetOrgPoolParamsWithHTTPClient(client *http.Client) *GetOrgPoolParams {
|
||||
return &GetOrgPoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgPoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get org pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetOrgPoolParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
/* PoolID.
|
||||
|
||||
Pool ID.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetOrgPoolParams) WithDefaults() *GetOrgPoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetOrgPoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get org pool params
|
||||
func (o *GetOrgPoolParams) WithTimeout(timeout time.Duration) *GetOrgPoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get org pool params
|
||||
func (o *GetOrgPoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get org pool params
|
||||
func (o *GetOrgPoolParams) WithContext(ctx context.Context) *GetOrgPoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get org pool params
|
||||
func (o *GetOrgPoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get org pool params
|
||||
func (o *GetOrgPoolParams) WithHTTPClient(client *http.Client) *GetOrgPoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get org pool params
|
||||
func (o *GetOrgPoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the get org pool params
|
||||
func (o *GetOrgPoolParams) WithOrgID(orgID string) *GetOrgPoolParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the get org pool params
|
||||
func (o *GetOrgPoolParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the get org pool params
|
||||
func (o *GetOrgPoolParams) WithPoolID(poolID string) *GetOrgPoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the get org pool params
|
||||
func (o *GetOrgPoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetOrgPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/get_org_pool_responses.go
Normal file
179
client/organizations/get_org_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetOrgPoolReader is a Reader for the GetOrgPool structure.
|
||||
type GetOrgPoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetOrgPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetOrgPoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewGetOrgPoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgPoolOK creates a GetOrgPoolOK with default headers values
|
||||
func NewGetOrgPoolOK() *GetOrgPoolOK {
|
||||
return &GetOrgPoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgPoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type GetOrgPoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get org pool o k response has a 2xx status code
|
||||
func (o *GetOrgPoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get org pool o k response has a 3xx status code
|
||||
func (o *GetOrgPoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get org pool o k response has a 4xx status code
|
||||
func (o *GetOrgPoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get org pool o k response has a 5xx status code
|
||||
func (o *GetOrgPoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get org pool o k response a status code equal to that given
|
||||
func (o *GetOrgPoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get org pool o k response
|
||||
func (o *GetOrgPoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] getOrgPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] getOrgPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetOrgPoolDefault creates a GetOrgPoolDefault with default headers values
|
||||
func NewGetOrgPoolDefault(code int) *GetOrgPoolDefault {
|
||||
return &GetOrgPoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgPoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetOrgPoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get org pool default response has a 2xx status code
|
||||
func (o *GetOrgPoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get org pool default response has a 3xx status code
|
||||
func (o *GetOrgPoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get org pool default response has a 4xx status code
|
||||
func (o *GetOrgPoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get org pool default response has a 5xx status code
|
||||
func (o *GetOrgPoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this get org pool default response a status code equal to that given
|
||||
func (o *GetOrgPoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the get org pool default response
|
||||
func (o *GetOrgPoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] GetOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] GetOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/get_org_responses.go
Normal file
179
client/organizations/get_org_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetOrgReader is a Reader for the GetOrg structure.
|
||||
type GetOrgReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetOrgOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewGetOrgDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetOrgOK creates a GetOrgOK with default headers values
|
||||
func NewGetOrgOK() *GetOrgOK {
|
||||
return &GetOrgOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgOK describes a response with status code 200, with default header values.
|
||||
|
||||
Organization
|
||||
*/
|
||||
type GetOrgOK struct {
|
||||
Payload garm_params.Organization
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get org o k response has a 2xx status code
|
||||
func (o *GetOrgOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get org o k response has a 3xx status code
|
||||
func (o *GetOrgOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get org o k response has a 4xx status code
|
||||
func (o *GetOrgOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get org o k response has a 5xx status code
|
||||
func (o *GetOrgOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get org o k response a status code equal to that given
|
||||
func (o *GetOrgOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get org o k response
|
||||
func (o *GetOrgOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetOrgOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] getOrgOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] getOrgOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgOK) GetPayload() garm_params.Organization {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetOrgOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetOrgDefault creates a GetOrgDefault with default headers values
|
||||
func NewGetOrgDefault(code int) *GetOrgDefault {
|
||||
return &GetOrgDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetOrgDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get org default response has a 2xx status code
|
||||
func (o *GetOrgDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get org default response has a 3xx status code
|
||||
func (o *GetOrgDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get org default response has a 4xx status code
|
||||
func (o *GetOrgDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get org default response has a 5xx status code
|
||||
func (o *GetOrgDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this get org default response a status code equal to that given
|
||||
func (o *GetOrgDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the get org default response
|
||||
func (o *GetOrgDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *GetOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] GetOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] GetOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetOrgDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/organizations/list_org_instances_parameters.go
Normal file
151
client/organizations/list_org_instances_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListOrgInstancesParams creates a new ListOrgInstancesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListOrgInstancesParams() *ListOrgInstancesParams {
|
||||
return &ListOrgInstancesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgInstancesParamsWithTimeout creates a new ListOrgInstancesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListOrgInstancesParamsWithTimeout(timeout time.Duration) *ListOrgInstancesParams {
|
||||
return &ListOrgInstancesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgInstancesParamsWithContext creates a new ListOrgInstancesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListOrgInstancesParamsWithContext(ctx context.Context) *ListOrgInstancesParams {
|
||||
return &ListOrgInstancesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgInstancesParamsWithHTTPClient creates a new ListOrgInstancesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListOrgInstancesParamsWithHTTPClient(client *http.Client) *ListOrgInstancesParams {
|
||||
return &ListOrgInstancesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgInstancesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list org instances operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListOrgInstancesParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list org instances params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListOrgInstancesParams) WithDefaults() *ListOrgInstancesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list org instances params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListOrgInstancesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list org instances params
|
||||
func (o *ListOrgInstancesParams) WithTimeout(timeout time.Duration) *ListOrgInstancesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list org instances params
|
||||
func (o *ListOrgInstancesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list org instances params
|
||||
func (o *ListOrgInstancesParams) WithContext(ctx context.Context) *ListOrgInstancesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list org instances params
|
||||
func (o *ListOrgInstancesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list org instances params
|
||||
func (o *ListOrgInstancesParams) WithHTTPClient(client *http.Client) *ListOrgInstancesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list org instances params
|
||||
func (o *ListOrgInstancesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the list org instances params
|
||||
func (o *ListOrgInstancesParams) WithOrgID(orgID string) *ListOrgInstancesParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the list org instances params
|
||||
func (o *ListOrgInstancesParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListOrgInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/list_org_instances_responses.go
Normal file
179
client/organizations/list_org_instances_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListOrgInstancesReader is a Reader for the ListOrgInstances structure.
|
||||
type ListOrgInstancesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListOrgInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListOrgInstancesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListOrgInstancesDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgInstancesOK creates a ListOrgInstancesOK with default headers values
|
||||
func NewListOrgInstancesOK() *ListOrgInstancesOK {
|
||||
return &ListOrgInstancesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgInstancesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Instances
|
||||
*/
|
||||
type ListOrgInstancesOK struct {
|
||||
Payload garm_params.Instances
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list org instances o k response has a 2xx status code
|
||||
func (o *ListOrgInstancesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list org instances o k response has a 3xx status code
|
||||
func (o *ListOrgInstancesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list org instances o k response has a 4xx status code
|
||||
func (o *ListOrgInstancesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list org instances o k response has a 5xx status code
|
||||
func (o *ListOrgInstancesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list org instances o k response a status code equal to that given
|
||||
func (o *ListOrgInstancesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list org instances o k response
|
||||
func (o *ListOrgInstancesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] listOrgInstancesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] listOrgInstancesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) GetPayload() garm_params.Instances {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListOrgInstancesDefault creates a ListOrgInstancesDefault with default headers values
|
||||
func NewListOrgInstancesDefault(code int) *ListOrgInstancesDefault {
|
||||
return &ListOrgInstancesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgInstancesDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListOrgInstancesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list org instances default response has a 2xx status code
|
||||
func (o *ListOrgInstancesDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list org instances default response has a 3xx status code
|
||||
func (o *ListOrgInstancesDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list org instances default response has a 4xx status code
|
||||
func (o *ListOrgInstancesDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list org instances default response has a 5xx status code
|
||||
func (o *ListOrgInstancesDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list org instances default response a status code equal to that given
|
||||
func (o *ListOrgInstancesDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list org instances default response
|
||||
func (o *ListOrgInstancesDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] ListOrgInstances default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] ListOrgInstances default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/organizations/list_org_pools_parameters.go
Normal file
151
client/organizations/list_org_pools_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListOrgPoolsParams creates a new ListOrgPoolsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListOrgPoolsParams() *ListOrgPoolsParams {
|
||||
return &ListOrgPoolsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgPoolsParamsWithTimeout creates a new ListOrgPoolsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListOrgPoolsParamsWithTimeout(timeout time.Duration) *ListOrgPoolsParams {
|
||||
return &ListOrgPoolsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgPoolsParamsWithContext creates a new ListOrgPoolsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListOrgPoolsParamsWithContext(ctx context.Context) *ListOrgPoolsParams {
|
||||
return &ListOrgPoolsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgPoolsParamsWithHTTPClient creates a new ListOrgPoolsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListOrgPoolsParamsWithHTTPClient(client *http.Client) *ListOrgPoolsParams {
|
||||
return &ListOrgPoolsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgPoolsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list org pools operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListOrgPoolsParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list org pools params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListOrgPoolsParams) WithDefaults() *ListOrgPoolsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list org pools params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListOrgPoolsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list org pools params
|
||||
func (o *ListOrgPoolsParams) WithTimeout(timeout time.Duration) *ListOrgPoolsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list org pools params
|
||||
func (o *ListOrgPoolsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list org pools params
|
||||
func (o *ListOrgPoolsParams) WithContext(ctx context.Context) *ListOrgPoolsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list org pools params
|
||||
func (o *ListOrgPoolsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list org pools params
|
||||
func (o *ListOrgPoolsParams) WithHTTPClient(client *http.Client) *ListOrgPoolsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list org pools params
|
||||
func (o *ListOrgPoolsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the list org pools params
|
||||
func (o *ListOrgPoolsParams) WithOrgID(orgID string) *ListOrgPoolsParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the list org pools params
|
||||
func (o *ListOrgPoolsParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListOrgPoolsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/list_org_pools_responses.go
Normal file
179
client/organizations/list_org_pools_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListOrgPoolsReader is a Reader for the ListOrgPools structure.
|
||||
type ListOrgPoolsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListOrgPoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListOrgPoolsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListOrgPoolsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgPoolsOK creates a ListOrgPoolsOK with default headers values
|
||||
func NewListOrgPoolsOK() *ListOrgPoolsOK {
|
||||
return &ListOrgPoolsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgPoolsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pools
|
||||
*/
|
||||
type ListOrgPoolsOK struct {
|
||||
Payload garm_params.Pools
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list org pools o k response has a 2xx status code
|
||||
func (o *ListOrgPoolsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list org pools o k response has a 3xx status code
|
||||
func (o *ListOrgPoolsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list org pools o k response has a 4xx status code
|
||||
func (o *ListOrgPoolsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list org pools o k response has a 5xx status code
|
||||
func (o *ListOrgPoolsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list org pools o k response a status code equal to that given
|
||||
func (o *ListOrgPoolsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list org pools o k response
|
||||
func (o *ListOrgPoolsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] listOrgPoolsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] listOrgPoolsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) GetPayload() garm_params.Pools {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListOrgPoolsDefault creates a ListOrgPoolsDefault with default headers values
|
||||
func NewListOrgPoolsDefault(code int) *ListOrgPoolsDefault {
|
||||
return &ListOrgPoolsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgPoolsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListOrgPoolsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list org pools default response has a 2xx status code
|
||||
func (o *ListOrgPoolsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list org pools default response has a 3xx status code
|
||||
func (o *ListOrgPoolsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list org pools default response has a 4xx status code
|
||||
func (o *ListOrgPoolsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list org pools default response has a 5xx status code
|
||||
func (o *ListOrgPoolsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list org pools default response a status code equal to that given
|
||||
func (o *ListOrgPoolsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list org pools default response
|
||||
func (o *ListOrgPoolsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] ListOrgPools default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] ListOrgPools default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
128
client/organizations/list_orgs_parameters.go
Normal file
128
client/organizations/list_orgs_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListOrgsParams creates a new ListOrgsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListOrgsParams() *ListOrgsParams {
|
||||
return &ListOrgsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgsParamsWithTimeout creates a new ListOrgsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListOrgsParamsWithTimeout(timeout time.Duration) *ListOrgsParams {
|
||||
return &ListOrgsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgsParamsWithContext creates a new ListOrgsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListOrgsParamsWithContext(ctx context.Context) *ListOrgsParams {
|
||||
return &ListOrgsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgsParamsWithHTTPClient creates a new ListOrgsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListOrgsParamsWithHTTPClient(client *http.Client) *ListOrgsParams {
|
||||
return &ListOrgsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list orgs operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListOrgsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list orgs params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListOrgsParams) WithDefaults() *ListOrgsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list orgs params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListOrgsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list orgs params
|
||||
func (o *ListOrgsParams) WithTimeout(timeout time.Duration) *ListOrgsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list orgs params
|
||||
func (o *ListOrgsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list orgs params
|
||||
func (o *ListOrgsParams) WithContext(ctx context.Context) *ListOrgsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list orgs params
|
||||
func (o *ListOrgsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list orgs params
|
||||
func (o *ListOrgsParams) WithHTTPClient(client *http.Client) *ListOrgsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list orgs params
|
||||
func (o *ListOrgsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListOrgsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/list_orgs_responses.go
Normal file
179
client/organizations/list_orgs_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListOrgsReader is a Reader for the ListOrgs structure.
|
||||
type ListOrgsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListOrgsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListOrgsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListOrgsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListOrgsOK creates a ListOrgsOK with default headers values
|
||||
func NewListOrgsOK() *ListOrgsOK {
|
||||
return &ListOrgsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Organizations
|
||||
*/
|
||||
type ListOrgsOK struct {
|
||||
Payload garm_params.Organizations
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list orgs o k response has a 2xx status code
|
||||
func (o *ListOrgsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list orgs o k response has a 3xx status code
|
||||
func (o *ListOrgsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list orgs o k response has a 4xx status code
|
||||
func (o *ListOrgsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list orgs o k response has a 5xx status code
|
||||
func (o *ListOrgsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list orgs o k response a status code equal to that given
|
||||
func (o *ListOrgsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list orgs o k response
|
||||
func (o *ListOrgsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListOrgsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] listOrgsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] listOrgsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsOK) GetPayload() garm_params.Organizations {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListOrgsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListOrgsDefault creates a ListOrgsDefault with default headers values
|
||||
func NewListOrgsDefault(code int) *ListOrgsDefault {
|
||||
return &ListOrgsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListOrgsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list orgs default response has a 2xx status code
|
||||
func (o *ListOrgsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list orgs default response has a 3xx status code
|
||||
func (o *ListOrgsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list orgs default response has a 4xx status code
|
||||
func (o *ListOrgsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list orgs default response has a 5xx status code
|
||||
func (o *ListOrgsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list orgs default response a status code equal to that given
|
||||
func (o *ListOrgsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list orgs default response
|
||||
func (o *ListOrgsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListOrgsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] ListOrgs default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] ListOrgs default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListOrgsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
465
client/organizations/organizations_client.go
Normal file
465
client/organizations/organizations_client.go
Normal file
|
|
@ -0,0 +1,465 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new organizations API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for organizations API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
CreateOrg(params *CreateOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgOK, error)
|
||||
|
||||
CreateOrgPool(params *CreateOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgPoolOK, error)
|
||||
|
||||
DeleteOrg(params *DeleteOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
DeleteOrgPool(params *DeleteOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
GetOrg(params *GetOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgOK, error)
|
||||
|
||||
GetOrgPool(params *GetOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgPoolOK, error)
|
||||
|
||||
ListOrgInstances(params *ListOrgInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgInstancesOK, error)
|
||||
|
||||
ListOrgPools(params *ListOrgPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgPoolsOK, error)
|
||||
|
||||
ListOrgs(params *ListOrgsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgsOK, error)
|
||||
|
||||
UpdateOrg(params *UpdateOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgOK, error)
|
||||
|
||||
UpdateOrgPool(params *UpdateOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgPoolOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrg creates organization with the parameters given
|
||||
*/
|
||||
func (a *Client) CreateOrg(params *CreateOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateOrgParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "CreateOrg",
|
||||
Method: "POST",
|
||||
PathPattern: "/organizations",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateOrgReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateOrgOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*CreateOrgDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrgPool creates organization pool with the parameters given
|
||||
*/
|
||||
func (a *Client) CreateOrgPool(params *CreateOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgPoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateOrgPoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "CreateOrgPool",
|
||||
Method: "POST",
|
||||
PathPattern: "/organizations/{orgID}/pools",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateOrgPoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateOrgPoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*CreateOrgPoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrg deletes organization by ID
|
||||
*/
|
||||
func (a *Client) DeleteOrg(params *DeleteOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteOrgParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteOrg",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/organizations/{orgID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteOrgReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrgPool deletes organization pool by ID
|
||||
*/
|
||||
func (a *Client) DeleteOrgPool(params *DeleteOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteOrgPoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteOrgPool",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/organizations/{orgID}/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteOrgPoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrg gets organization by ID
|
||||
*/
|
||||
func (a *Client) GetOrg(params *GetOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetOrgParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetOrg",
|
||||
Method: "GET",
|
||||
PathPattern: "/organizations/{orgID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetOrgReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetOrgOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*GetOrgDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
GetOrgPool gets organization pool by ID
|
||||
*/
|
||||
func (a *Client) GetOrgPool(params *GetOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgPoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetOrgPoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetOrgPool",
|
||||
Method: "GET",
|
||||
PathPattern: "/organizations/{orgID}/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetOrgPoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetOrgPoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*GetOrgPoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgInstances lists organization instances
|
||||
*/
|
||||
func (a *Client) ListOrgInstances(params *ListOrgInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgInstancesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListOrgInstancesParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListOrgInstances",
|
||||
Method: "GET",
|
||||
PathPattern: "/organizations/{orgID}/instances",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListOrgInstancesReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListOrgInstancesOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListOrgInstancesDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgPools lists organization pools
|
||||
*/
|
||||
func (a *Client) ListOrgPools(params *ListOrgPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgPoolsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListOrgPoolsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListOrgPools",
|
||||
Method: "GET",
|
||||
PathPattern: "/organizations/{orgID}/pools",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListOrgPoolsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListOrgPoolsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListOrgPoolsDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgs lists organizations
|
||||
*/
|
||||
func (a *Client) ListOrgs(params *ListOrgsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListOrgsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListOrgs",
|
||||
Method: "GET",
|
||||
PathPattern: "/organizations",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListOrgsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListOrgsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListOrgsDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrg updates organization with the parameters given
|
||||
*/
|
||||
func (a *Client) UpdateOrg(params *UpdateOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateOrgParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateOrg",
|
||||
Method: "PUT",
|
||||
PathPattern: "/organizations/{orgID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateOrgReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateOrgOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*UpdateOrgDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgPool updates organization pool with the parameters given
|
||||
*/
|
||||
func (a *Client) UpdateOrgPool(params *UpdateOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgPoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateOrgPoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateOrgPool",
|
||||
Method: "PUT",
|
||||
PathPattern: "/organizations/{orgID}/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateOrgPoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateOrgPoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*UpdateOrgPoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
173
client/organizations/update_org_parameters.go
Normal file
173
client/organizations/update_org_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateOrgParams creates a new UpdateOrgParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateOrgParams() *UpdateOrgParams {
|
||||
return &UpdateOrgParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgParamsWithTimeout creates a new UpdateOrgParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateOrgParamsWithTimeout(timeout time.Duration) *UpdateOrgParams {
|
||||
return &UpdateOrgParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgParamsWithContext creates a new UpdateOrgParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateOrgParamsWithContext(ctx context.Context) *UpdateOrgParams {
|
||||
return &UpdateOrgParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgParamsWithHTTPClient creates a new UpdateOrgParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateOrgParamsWithHTTPClient(client *http.Client) *UpdateOrgParams {
|
||||
return &UpdateOrgParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update org operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateOrgParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating the organization.
|
||||
*/
|
||||
Body garm_params.UpdateEntityParams
|
||||
|
||||
/* OrgID.
|
||||
|
||||
ID of the organization to update.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateOrgParams) WithDefaults() *UpdateOrgParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateOrgParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update org params
|
||||
func (o *UpdateOrgParams) WithTimeout(timeout time.Duration) *UpdateOrgParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update org params
|
||||
func (o *UpdateOrgParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update org params
|
||||
func (o *UpdateOrgParams) WithContext(ctx context.Context) *UpdateOrgParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update org params
|
||||
func (o *UpdateOrgParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update org params
|
||||
func (o *UpdateOrgParams) WithHTTPClient(client *http.Client) *UpdateOrgParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update org params
|
||||
func (o *UpdateOrgParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update org params
|
||||
func (o *UpdateOrgParams) WithBody(body garm_params.UpdateEntityParams) *UpdateOrgParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update org params
|
||||
func (o *UpdateOrgParams) SetBody(body garm_params.UpdateEntityParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the update org params
|
||||
func (o *UpdateOrgParams) WithOrgID(orgID string) *UpdateOrgParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the update org params
|
||||
func (o *UpdateOrgParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateOrgParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
195
client/organizations/update_org_pool_parameters.go
Normal file
195
client/organizations/update_org_pool_parameters.go
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateOrgPoolParams creates a new UpdateOrgPoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateOrgPoolParams() *UpdateOrgPoolParams {
|
||||
return &UpdateOrgPoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgPoolParamsWithTimeout creates a new UpdateOrgPoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateOrgPoolParamsWithTimeout(timeout time.Duration) *UpdateOrgPoolParams {
|
||||
return &UpdateOrgPoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgPoolParamsWithContext creates a new UpdateOrgPoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateOrgPoolParamsWithContext(ctx context.Context) *UpdateOrgPoolParams {
|
||||
return &UpdateOrgPoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgPoolParamsWithHTTPClient creates a new UpdateOrgPoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateOrgPoolParamsWithHTTPClient(client *http.Client) *UpdateOrgPoolParams {
|
||||
return &UpdateOrgPoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgPoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update org pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateOrgPoolParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating the organization pool.
|
||||
*/
|
||||
Body garm_params.UpdatePoolParams
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the organization pool to update.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateOrgPoolParams) WithDefaults() *UpdateOrgPoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update org pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateOrgPoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) WithTimeout(timeout time.Duration) *UpdateOrgPoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) WithContext(ctx context.Context) *UpdateOrgPoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) WithHTTPClient(client *http.Client) *UpdateOrgPoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) WithBody(body garm_params.UpdatePoolParams) *UpdateOrgPoolParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) SetBody(body garm_params.UpdatePoolParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) WithOrgID(orgID string) *UpdateOrgPoolParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) WithPoolID(poolID string) *UpdateOrgPoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the update org pool params
|
||||
func (o *UpdateOrgPoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateOrgPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param orgID
|
||||
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/update_org_pool_responses.go
Normal file
179
client/organizations/update_org_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateOrgPoolReader is a Reader for the UpdateOrgPool structure.
|
||||
type UpdateOrgPoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateOrgPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateOrgPoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewUpdateOrgPoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgPoolOK creates a UpdateOrgPoolOK with default headers values
|
||||
func NewUpdateOrgPoolOK() *UpdateOrgPoolOK {
|
||||
return &UpdateOrgPoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgPoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type UpdateOrgPoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update org pool o k response has a 2xx status code
|
||||
func (o *UpdateOrgPoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update org pool o k response has a 3xx status code
|
||||
func (o *UpdateOrgPoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update org pool o k response has a 4xx status code
|
||||
func (o *UpdateOrgPoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update org pool o k response has a 5xx status code
|
||||
func (o *UpdateOrgPoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update org pool o k response a status code equal to that given
|
||||
func (o *UpdateOrgPoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update org pool o k response
|
||||
func (o *UpdateOrgPoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] updateOrgPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] updateOrgPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateOrgPoolDefault creates a UpdateOrgPoolDefault with default headers values
|
||||
func NewUpdateOrgPoolDefault(code int) *UpdateOrgPoolDefault {
|
||||
return &UpdateOrgPoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgPoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateOrgPoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update org pool default response has a 2xx status code
|
||||
func (o *UpdateOrgPoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update org pool default response has a 3xx status code
|
||||
func (o *UpdateOrgPoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update org pool default response has a 4xx status code
|
||||
func (o *UpdateOrgPoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update org pool default response has a 5xx status code
|
||||
func (o *UpdateOrgPoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this update org pool default response a status code equal to that given
|
||||
func (o *UpdateOrgPoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the update org pool default response
|
||||
func (o *UpdateOrgPoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] UpdateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] UpdateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
179
client/organizations/update_org_responses.go
Normal file
179
client/organizations/update_org_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package organizations
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateOrgReader is a Reader for the UpdateOrg structure.
|
||||
type UpdateOrgReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateOrgOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewUpdateOrgDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateOrgOK creates a UpdateOrgOK with default headers values
|
||||
func NewUpdateOrgOK() *UpdateOrgOK {
|
||||
return &UpdateOrgOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgOK describes a response with status code 200, with default header values.
|
||||
|
||||
Organization
|
||||
*/
|
||||
type UpdateOrgOK struct {
|
||||
Payload garm_params.Organization
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update org o k response has a 2xx status code
|
||||
func (o *UpdateOrgOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update org o k response has a 3xx status code
|
||||
func (o *UpdateOrgOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update org o k response has a 4xx status code
|
||||
func (o *UpdateOrgOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update org o k response has a 5xx status code
|
||||
func (o *UpdateOrgOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update org o k response a status code equal to that given
|
||||
func (o *UpdateOrgOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update org o k response
|
||||
func (o *UpdateOrgOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateOrgOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] updateOrgOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgOK) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] updateOrgOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgOK) GetPayload() garm_params.Organization {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateOrgOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateOrgDefault creates a UpdateOrgDefault with default headers values
|
||||
func NewUpdateOrgDefault(code int) *UpdateOrgDefault {
|
||||
return &UpdateOrgDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrgDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateOrgDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update org default response has a 2xx status code
|
||||
func (o *UpdateOrgDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update org default response has a 3xx status code
|
||||
func (o *UpdateOrgDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update org default response has a 4xx status code
|
||||
func (o *UpdateOrgDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update org default response has a 5xx status code
|
||||
func (o *UpdateOrgDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this update org default response a status code equal to that given
|
||||
func (o *UpdateOrgDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the update org default response
|
||||
func (o *UpdateOrgDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UpdateOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] UpdateOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] UpdateOrg default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateOrgDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/pools/delete_pool_parameters.go
Normal file
151
client/pools/delete_pool_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeletePoolParams creates a new DeletePoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeletePoolParams() *DeletePoolParams {
|
||||
return &DeletePoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeletePoolParamsWithTimeout creates a new DeletePoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeletePoolParamsWithTimeout(timeout time.Duration) *DeletePoolParams {
|
||||
return &DeletePoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeletePoolParamsWithContext creates a new DeletePoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeletePoolParamsWithContext(ctx context.Context) *DeletePoolParams {
|
||||
return &DeletePoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeletePoolParamsWithHTTPClient creates a new DeletePoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeletePoolParamsWithHTTPClient(client *http.Client) *DeletePoolParams {
|
||||
return &DeletePoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeletePoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeletePoolParams struct {
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the pool to delete.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeletePoolParams) WithDefaults() *DeletePoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeletePoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete pool params
|
||||
func (o *DeletePoolParams) WithTimeout(timeout time.Duration) *DeletePoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete pool params
|
||||
func (o *DeletePoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete pool params
|
||||
func (o *DeletePoolParams) WithContext(ctx context.Context) *DeletePoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete pool params
|
||||
func (o *DeletePoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete pool params
|
||||
func (o *DeletePoolParams) WithHTTPClient(client *http.Client) *DeletePoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete pool params
|
||||
func (o *DeletePoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the delete pool params
|
||||
func (o *DeletePoolParams) WithPoolID(poolID string) *DeletePoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the delete pool params
|
||||
func (o *DeletePoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeletePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
103
client/pools/delete_pool_responses.go
Normal file
103
client/pools/delete_pool_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeletePoolReader is a Reader for the DeletePool structure.
|
||||
type DeletePoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeletePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeletePoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeletePoolDefault creates a DeletePoolDefault with default headers values
|
||||
func NewDeletePoolDefault(code int) *DeletePoolDefault {
|
||||
return &DeletePoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeletePoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeletePoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete pool default response has a 2xx status code
|
||||
func (o *DeletePoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete pool default response has a 3xx status code
|
||||
func (o *DeletePoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete pool default response has a 4xx status code
|
||||
func (o *DeletePoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete pool default response has a 5xx status code
|
||||
func (o *DeletePoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete pool default response a status code equal to that given
|
||||
func (o *DeletePoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete pool default response
|
||||
func (o *DeletePoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeletePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /pools/{poolID}][%d] DeletePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeletePoolDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /pools/{poolID}][%d] DeletePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeletePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeletePoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/pools/get_pool_parameters.go
Normal file
151
client/pools/get_pool_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetPoolParams creates a new GetPoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetPoolParams() *GetPoolParams {
|
||||
return &GetPoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetPoolParamsWithTimeout creates a new GetPoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetPoolParamsWithTimeout(timeout time.Duration) *GetPoolParams {
|
||||
return &GetPoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetPoolParamsWithContext creates a new GetPoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetPoolParamsWithContext(ctx context.Context) *GetPoolParams {
|
||||
return &GetPoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetPoolParamsWithHTTPClient creates a new GetPoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetPoolParamsWithHTTPClient(client *http.Client) *GetPoolParams {
|
||||
return &GetPoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetPoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetPoolParams struct {
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the pool to fetch.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetPoolParams) WithDefaults() *GetPoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetPoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get pool params
|
||||
func (o *GetPoolParams) WithTimeout(timeout time.Duration) *GetPoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get pool params
|
||||
func (o *GetPoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get pool params
|
||||
func (o *GetPoolParams) WithContext(ctx context.Context) *GetPoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get pool params
|
||||
func (o *GetPoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get pool params
|
||||
func (o *GetPoolParams) WithHTTPClient(client *http.Client) *GetPoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get pool params
|
||||
func (o *GetPoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the get pool params
|
||||
func (o *GetPoolParams) WithPoolID(poolID string) *GetPoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the get pool params
|
||||
func (o *GetPoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/pools/get_pool_responses.go
Normal file
179
client/pools/get_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetPoolReader is a Reader for the GetPool structure.
|
||||
type GetPoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetPoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewGetPoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetPoolOK creates a GetPoolOK with default headers values
|
||||
func NewGetPoolOK() *GetPoolOK {
|
||||
return &GetPoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetPoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type GetPoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get pool o k response has a 2xx status code
|
||||
func (o *GetPoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get pool o k response has a 3xx status code
|
||||
func (o *GetPoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get pool o k response has a 4xx status code
|
||||
func (o *GetPoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get pool o k response has a 5xx status code
|
||||
func (o *GetPoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get pool o k response a status code equal to that given
|
||||
func (o *GetPoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get pool o k response
|
||||
func (o *GetPoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetPoolOK) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] getPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolOK) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] getPoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetPoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetPoolDefault creates a GetPoolDefault with default headers values
|
||||
func NewGetPoolDefault(code int) *GetPoolDefault {
|
||||
return &GetPoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetPoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetPoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get pool default response has a 2xx status code
|
||||
func (o *GetPoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get pool default response has a 3xx status code
|
||||
func (o *GetPoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get pool default response has a 4xx status code
|
||||
func (o *GetPoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get pool default response has a 5xx status code
|
||||
func (o *GetPoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this get pool default response a status code equal to that given
|
||||
func (o *GetPoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the get pool default response
|
||||
func (o *GetPoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *GetPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] GetPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolDefault) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] GetPool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetPoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
128
client/pools/list_pools_parameters.go
Normal file
128
client/pools/list_pools_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListPoolsParams creates a new ListPoolsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListPoolsParams() *ListPoolsParams {
|
||||
return &ListPoolsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolsParamsWithTimeout creates a new ListPoolsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListPoolsParamsWithTimeout(timeout time.Duration) *ListPoolsParams {
|
||||
return &ListPoolsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolsParamsWithContext creates a new ListPoolsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListPoolsParamsWithContext(ctx context.Context) *ListPoolsParams {
|
||||
return &ListPoolsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolsParamsWithHTTPClient creates a new ListPoolsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListPoolsParamsWithHTTPClient(client *http.Client) *ListPoolsParams {
|
||||
return &ListPoolsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list pools operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListPoolsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list pools params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListPoolsParams) WithDefaults() *ListPoolsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list pools params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListPoolsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list pools params
|
||||
func (o *ListPoolsParams) WithTimeout(timeout time.Duration) *ListPoolsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list pools params
|
||||
func (o *ListPoolsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list pools params
|
||||
func (o *ListPoolsParams) WithContext(ctx context.Context) *ListPoolsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list pools params
|
||||
func (o *ListPoolsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list pools params
|
||||
func (o *ListPoolsParams) WithHTTPClient(client *http.Client) *ListPoolsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list pools params
|
||||
func (o *ListPoolsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListPoolsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/pools/list_pools_responses.go
Normal file
179
client/pools/list_pools_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListPoolsReader is a Reader for the ListPools structure.
|
||||
type ListPoolsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListPoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListPoolsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListPoolsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListPoolsOK creates a ListPoolsOK with default headers values
|
||||
func NewListPoolsOK() *ListPoolsOK {
|
||||
return &ListPoolsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pools
|
||||
*/
|
||||
type ListPoolsOK struct {
|
||||
Payload garm_params.Pools
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list pools o k response has a 2xx status code
|
||||
func (o *ListPoolsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list pools o k response has a 3xx status code
|
||||
func (o *ListPoolsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list pools o k response has a 4xx status code
|
||||
func (o *ListPoolsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list pools o k response has a 5xx status code
|
||||
func (o *ListPoolsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list pools o k response a status code equal to that given
|
||||
func (o *ListPoolsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list pools o k response
|
||||
func (o *ListPoolsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListPoolsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] listPoolsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsOK) String() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] listPoolsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsOK) GetPayload() garm_params.Pools {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListPoolsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListPoolsDefault creates a ListPoolsDefault with default headers values
|
||||
func NewListPoolsDefault(code int) *ListPoolsDefault {
|
||||
return &ListPoolsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListPoolsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListPoolsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list pools default response has a 2xx status code
|
||||
func (o *ListPoolsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list pools default response has a 3xx status code
|
||||
func (o *ListPoolsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list pools default response has a 4xx status code
|
||||
func (o *ListPoolsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list pools default response has a 5xx status code
|
||||
func (o *ListPoolsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list pools default response a status code equal to that given
|
||||
func (o *ListPoolsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list pools default response
|
||||
func (o *ListPoolsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListPoolsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] ListPools default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] ListPools default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListPoolsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
191
client/pools/pools_client.go
Normal file
191
client/pools/pools_client.go
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new pools API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for pools API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
DeletePool(params *DeletePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
GetPool(params *GetPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPoolOK, error)
|
||||
|
||||
ListPools(params *ListPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPoolsOK, error)
|
||||
|
||||
UpdatePool(params *UpdatePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdatePoolOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
DeletePool deletes pool by ID
|
||||
*/
|
||||
func (a *Client) DeletePool(params *DeletePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeletePoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeletePool",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeletePoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetPool gets pool by ID
|
||||
*/
|
||||
func (a *Client) GetPool(params *GetPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetPoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetPool",
|
||||
Method: "GET",
|
||||
PathPattern: "/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetPoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetPoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*GetPoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListPools lists all pools
|
||||
*/
|
||||
func (a *Client) ListPools(params *ListPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPoolsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListPoolsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListPools",
|
||||
Method: "GET",
|
||||
PathPattern: "/pools",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListPoolsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListPoolsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListPoolsDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UpdatePool updates pool by ID
|
||||
*/
|
||||
func (a *Client) UpdatePool(params *UpdatePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdatePoolOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdatePoolParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdatePool",
|
||||
Method: "PUT",
|
||||
PathPattern: "/pools/{poolID}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdatePoolReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdatePoolOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*UpdatePoolDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
173
client/pools/update_pool_parameters.go
Normal file
173
client/pools/update_pool_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdatePoolParams creates a new UpdatePoolParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdatePoolParams() *UpdatePoolParams {
|
||||
return &UpdatePoolParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdatePoolParamsWithTimeout creates a new UpdatePoolParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdatePoolParamsWithTimeout(timeout time.Duration) *UpdatePoolParams {
|
||||
return &UpdatePoolParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdatePoolParamsWithContext creates a new UpdatePoolParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdatePoolParamsWithContext(ctx context.Context) *UpdatePoolParams {
|
||||
return &UpdatePoolParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdatePoolParamsWithHTTPClient creates a new UpdatePoolParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdatePoolParamsWithHTTPClient(client *http.Client) *UpdatePoolParams {
|
||||
return &UpdatePoolParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdatePoolParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update pool operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdatePoolParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters to update the pool with.
|
||||
*/
|
||||
Body garm_params.UpdatePoolParams
|
||||
|
||||
/* PoolID.
|
||||
|
||||
ID of the pool to update.
|
||||
*/
|
||||
PoolID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdatePoolParams) WithDefaults() *UpdatePoolParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update pool params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdatePoolParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update pool params
|
||||
func (o *UpdatePoolParams) WithTimeout(timeout time.Duration) *UpdatePoolParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update pool params
|
||||
func (o *UpdatePoolParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update pool params
|
||||
func (o *UpdatePoolParams) WithContext(ctx context.Context) *UpdatePoolParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update pool params
|
||||
func (o *UpdatePoolParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update pool params
|
||||
func (o *UpdatePoolParams) WithHTTPClient(client *http.Client) *UpdatePoolParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update pool params
|
||||
func (o *UpdatePoolParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update pool params
|
||||
func (o *UpdatePoolParams) WithBody(body garm_params.UpdatePoolParams) *UpdatePoolParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update pool params
|
||||
func (o *UpdatePoolParams) SetBody(body garm_params.UpdatePoolParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithPoolID adds the poolID to the update pool params
|
||||
func (o *UpdatePoolParams) WithPoolID(poolID string) *UpdatePoolParams {
|
||||
o.SetPoolID(poolID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPoolID adds the poolId to the update pool params
|
||||
func (o *UpdatePoolParams) SetPoolID(poolID string) {
|
||||
o.PoolID = poolID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdatePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param poolID
|
||||
if err := r.SetPathParam("poolID", o.PoolID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/pools/update_pool_responses.go
Normal file
179
client/pools/update_pool_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package pools
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdatePoolReader is a Reader for the UpdatePool structure.
|
||||
type UpdatePoolReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdatePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdatePoolOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewUpdatePoolDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdatePoolOK creates a UpdatePoolOK with default headers values
|
||||
func NewUpdatePoolOK() *UpdatePoolOK {
|
||||
return &UpdatePoolOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdatePoolOK describes a response with status code 200, with default header values.
|
||||
|
||||
Pool
|
||||
*/
|
||||
type UpdatePoolOK struct {
|
||||
Payload garm_params.Pool
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update pool o k response has a 2xx status code
|
||||
func (o *UpdatePoolOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update pool o k response has a 3xx status code
|
||||
func (o *UpdatePoolOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update pool o k response has a 4xx status code
|
||||
func (o *UpdatePoolOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update pool o k response has a 5xx status code
|
||||
func (o *UpdatePoolOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update pool o k response a status code equal to that given
|
||||
func (o *UpdatePoolOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update pool o k response
|
||||
func (o *UpdatePoolOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdatePoolOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /pools/{poolID}][%d] updatePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdatePoolOK) String() string {
|
||||
return fmt.Sprintf("[PUT /pools/{poolID}][%d] updatePoolOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdatePoolOK) GetPayload() garm_params.Pool {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdatePoolOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdatePoolDefault creates a UpdatePoolDefault with default headers values
|
||||
func NewUpdatePoolDefault(code int) *UpdatePoolDefault {
|
||||
return &UpdatePoolDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdatePoolDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdatePoolDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update pool default response has a 2xx status code
|
||||
func (o *UpdatePoolDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update pool default response has a 3xx status code
|
||||
func (o *UpdatePoolDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update pool default response has a 4xx status code
|
||||
func (o *UpdatePoolDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update pool default response has a 5xx status code
|
||||
func (o *UpdatePoolDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this update pool default response a status code equal to that given
|
||||
func (o *UpdatePoolDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the update pool default response
|
||||
func (o *UpdatePoolDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UpdatePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /pools/{poolID}][%d] UpdatePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdatePoolDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /pools/{poolID}][%d] UpdatePool default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UpdatePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdatePoolDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
128
client/providers/list_providers_parameters.go
Normal file
128
client/providers/list_providers_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package providers
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListProvidersParams creates a new ListProvidersParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListProvidersParams() *ListProvidersParams {
|
||||
return &ListProvidersParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListProvidersParamsWithTimeout creates a new ListProvidersParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListProvidersParamsWithTimeout(timeout time.Duration) *ListProvidersParams {
|
||||
return &ListProvidersParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListProvidersParamsWithContext creates a new ListProvidersParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListProvidersParamsWithContext(ctx context.Context) *ListProvidersParams {
|
||||
return &ListProvidersParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListProvidersParamsWithHTTPClient creates a new ListProvidersParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListProvidersParamsWithHTTPClient(client *http.Client) *ListProvidersParams {
|
||||
return &ListProvidersParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListProvidersParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list providers operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListProvidersParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list providers params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListProvidersParams) WithDefaults() *ListProvidersParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list providers params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListProvidersParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list providers params
|
||||
func (o *ListProvidersParams) WithTimeout(timeout time.Duration) *ListProvidersParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list providers params
|
||||
func (o *ListProvidersParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list providers params
|
||||
func (o *ListProvidersParams) WithContext(ctx context.Context) *ListProvidersParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list providers params
|
||||
func (o *ListProvidersParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list providers params
|
||||
func (o *ListProvidersParams) WithHTTPClient(client *http.Client) *ListProvidersParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list providers params
|
||||
func (o *ListProvidersParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListProvidersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
174
client/providers/list_providers_responses.go
Normal file
174
client/providers/list_providers_responses.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package providers
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListProvidersReader is a Reader for the ListProviders structure.
|
||||
type ListProvidersReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListProvidersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListProvidersOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewListProvidersBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /providers] ListProviders", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewListProvidersOK creates a ListProvidersOK with default headers values
|
||||
func NewListProvidersOK() *ListProvidersOK {
|
||||
return &ListProvidersOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListProvidersOK describes a response with status code 200, with default header values.
|
||||
|
||||
Providers
|
||||
*/
|
||||
type ListProvidersOK struct {
|
||||
Payload garm_params.Providers
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list providers o k response has a 2xx status code
|
||||
func (o *ListProvidersOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list providers o k response has a 3xx status code
|
||||
func (o *ListProvidersOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list providers o k response has a 4xx status code
|
||||
func (o *ListProvidersOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list providers o k response has a 5xx status code
|
||||
func (o *ListProvidersOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list providers o k response a status code equal to that given
|
||||
func (o *ListProvidersOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list providers o k response
|
||||
func (o *ListProvidersOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListProvidersOK) Error() string {
|
||||
return fmt.Sprintf("[GET /providers][%d] listProvidersOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListProvidersOK) String() string {
|
||||
return fmt.Sprintf("[GET /providers][%d] listProvidersOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListProvidersOK) GetPayload() garm_params.Providers {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListProvidersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListProvidersBadRequest creates a ListProvidersBadRequest with default headers values
|
||||
func NewListProvidersBadRequest() *ListProvidersBadRequest {
|
||||
return &ListProvidersBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListProvidersBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListProvidersBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list providers bad request response has a 2xx status code
|
||||
func (o *ListProvidersBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list providers bad request response has a 3xx status code
|
||||
func (o *ListProvidersBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list providers bad request response has a 4xx status code
|
||||
func (o *ListProvidersBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list providers bad request response has a 5xx status code
|
||||
func (o *ListProvidersBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list providers bad request response a status code equal to that given
|
||||
func (o *ListProvidersBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the list providers bad request response
|
||||
func (o *ListProvidersBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *ListProvidersBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /providers][%d] listProvidersBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListProvidersBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /providers][%d] listProvidersBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListProvidersBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListProvidersBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
80
client/providers/providers_client.go
Normal file
80
client/providers/providers_client.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package providers
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new providers API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for providers API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ListProviders(params *ListProvidersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProvidersOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ListProviders lists all providers
|
||||
*/
|
||||
func (a *Client) ListProviders(params *ListProvidersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProvidersOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListProvidersParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListProviders",
|
||||
Method: "GET",
|
||||
PathPattern: "/providers",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListProvidersReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListProvidersOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for ListProviders: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
|
|
@ -1,301 +0,0 @@
|
|||
// Copyright 2022 Cloudbase Solutions SRL
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License. You may obtain
|
||||
// a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
apiParams "github.com/cloudbase/garm/apiserver/params"
|
||||
"github.com/cloudbase/garm/cmd/garm-cli/config"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func NewClient(name string, cfg config.Manager, debug bool) *Client {
|
||||
cli := resty.New()
|
||||
if cfg.Token != "" {
|
||||
cli = cli.SetAuthToken(cfg.Token)
|
||||
}
|
||||
cli = cli.
|
||||
SetHeader("Accept", "application/json").
|
||||
SetDebug(debug)
|
||||
return &Client{
|
||||
ManagerName: name,
|
||||
Config: cfg,
|
||||
client: cli,
|
||||
}
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
ManagerName string
|
||||
Config config.Manager
|
||||
client *resty.Client
|
||||
}
|
||||
|
||||
func (c *Client) handleError(err error, resp *resty.Response) error {
|
||||
var ret error
|
||||
if err != nil {
|
||||
ret = fmt.Errorf("request returned error: %s", err)
|
||||
}
|
||||
|
||||
if resp != nil && resp.IsError() {
|
||||
body := resp.Body()
|
||||
if len(body) > 0 {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr == nil {
|
||||
ret = fmt.Errorf("API returned error: %s", apiErr.Details)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *Client) decodeAPIError(body []byte) (apiParams.APIErrorResponse, error) {
|
||||
var errDetails apiParams.APIErrorResponse
|
||||
if err := json.Unmarshal(body, &errDetails); err != nil {
|
||||
return apiParams.APIErrorResponse{}, fmt.Errorf("invalid response from server, use --debug for more info")
|
||||
}
|
||||
|
||||
return errDetails, fmt.Errorf("error in API call: %s", errDetails.Details)
|
||||
}
|
||||
|
||||
func (c *Client) InitManager(url string, param params.NewUserParams) (params.User, error) {
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return params.User{}, errors.Wrap(err, "marshaling body")
|
||||
}
|
||||
url = fmt.Sprintf("%s/api/v1/first-run/", url)
|
||||
|
||||
var response params.User
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return params.User{}, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return params.User{}, fmt.Errorf("error running init: %s", apiErr.Details)
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) Login(url string, param params.PasswordLoginParams) (string, error) {
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "marshaling body")
|
||||
}
|
||||
url = fmt.Sprintf("%s/api/v1/auth/login", url)
|
||||
|
||||
var response params.JWTResponse
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return "", errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return "", fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
|
||||
return response.Token, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListCredentials() ([]params.GithubCredentials, error) {
|
||||
var ghCreds []params.GithubCredentials
|
||||
url := fmt.Sprintf("%s/api/v1/credentials", c.Config.BaseURL)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&ghCreds).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return nil, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return nil, fmt.Errorf("error fetching credentials: %s", apiErr.Details)
|
||||
}
|
||||
return ghCreds, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListProviders() ([]params.Provider, error) {
|
||||
var providers []params.Provider
|
||||
url := fmt.Sprintf("%s/api/v1/providers", c.Config.BaseURL)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&providers).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return nil, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return nil, fmt.Errorf("error fetching providers: %s", apiErr.Details)
|
||||
}
|
||||
return providers, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetInstanceByName(instanceName string) (params.Instance, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/instances/%s", c.Config.BaseURL, instanceName)
|
||||
|
||||
var response params.Instance
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return response, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return response, fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteRunner(instanceName string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/instances/%s", c.Config.BaseURL, instanceName)
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return fmt.Errorf("error deleting runner: %s", apiErr.Details)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) ListAllJobs() ([]params.Job, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/jobs", c.Config.BaseURL)
|
||||
|
||||
var response []params.Job
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
return response, c.handleError(err, resp)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListPoolInstances(poolID string) ([]params.Instance, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/pools/%s/instances", c.Config.BaseURL, poolID)
|
||||
|
||||
var response []params.Instance
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return response, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return response, fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListAllInstances() ([]params.Instance, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/instances", c.Config.BaseURL)
|
||||
|
||||
var response []params.Instance
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return response, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return response, fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetPoolByID(poolID string) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/pools/%s", c.Config.BaseURL, poolID)
|
||||
|
||||
var response params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return response, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return response, fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListAllPools() ([]params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/pools", c.Config.BaseURL)
|
||||
|
||||
var response []params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return response, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return response, fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeletePoolByID(poolID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/pools/%s", c.Config.BaseURL, poolID)
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return fmt.Errorf("error deleting pool by ID: %s", apiErr.Details)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdatePoolByID(poolID string, param params.UpdatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/pools/%s", c.Config.BaseURL, poolID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err != nil || resp.IsError() {
|
||||
apiErr, decErr := c.decodeAPIError(resp.Body())
|
||||
if decErr != nil {
|
||||
return response, errors.Wrap(decErr, "sending request")
|
||||
}
|
||||
return response, fmt.Errorf("error performing login: %s", apiErr.Details)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
|
@ -1,179 +0,0 @@
|
|||
// Copyright 2022 Cloudbase Solutions SRL
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License. You may obtain
|
||||
// a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (c *Client) ListEnterprises() ([]params.Enterprise, error) {
|
||||
var enterprises []params.Enterprise
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises", c.Config.BaseURL)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&enterprises).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return enterprises, nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateEnterprise(param params.CreateEnterpriseParams) (params.Enterprise, error) {
|
||||
var response params.Enterprise
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises", c.Config.BaseURL)
|
||||
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return params.Enterprise{}, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Enterprise{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateEnterprise(enterpriseID string, param params.UpdateEntityParams) (params.Enterprise, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s", c.Config.BaseURL, enterpriseID)
|
||||
|
||||
var response params.Enterprise
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Enterprise{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetEnterprise(enterpriseID string) (params.Enterprise, error) {
|
||||
var response params.Enterprise
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s", c.Config.BaseURL, enterpriseID)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Enterprise{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteEnterprise(enterpriseID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s", c.Config.BaseURL, enterpriseID)
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateEnterprisePool(enterpriseID string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s/pools", c.Config.BaseURL, enterpriseID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListEnterprisePools(enterpriseID string) ([]params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s/pools", c.Config.BaseURL, enterpriseID)
|
||||
|
||||
var response []params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetEnterprisePool(enterpriseID, poolID string) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s/pools/%s", c.Config.BaseURL, enterpriseID, poolID)
|
||||
|
||||
var response params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteEnterprisePool(enterpriseID, poolID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s/pools/%s", c.Config.BaseURL, enterpriseID, poolID)
|
||||
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateEnterprisePool(enterpriseID, poolID string, param params.UpdatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s/pools/%s", c.Config.BaseURL, enterpriseID, poolID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListEnterpriseInstances(enterpriseID string) ([]params.Instance, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/enterprises/%s/instances", c.Config.BaseURL, enterpriseID)
|
||||
|
||||
var response []params.Instance
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
// Copyright 2022 Cloudbase Solutions SRL
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License. You may obtain
|
||||
// a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (c *Client) ListOrganizations() ([]params.Organization, error) {
|
||||
var orgs []params.Organization
|
||||
url := fmt.Sprintf("%s/api/v1/organizations", c.Config.BaseURL)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&orgs).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgs, nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateOrganization(param params.CreateOrgParams) (params.Organization, error) {
|
||||
var response params.Organization
|
||||
url := fmt.Sprintf("%s/api/v1/organizations", c.Config.BaseURL)
|
||||
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return params.Organization{}, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Organization{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateOrganization(orgID string, param params.UpdateEntityParams) (params.Organization, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s", c.Config.BaseURL, orgID)
|
||||
|
||||
var response params.Organization
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Organization{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetOrganization(orgID string) (params.Organization, error) {
|
||||
var response params.Organization
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s", c.Config.BaseURL, orgID)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Organization{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteOrganization(orgID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s", c.Config.BaseURL, orgID)
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateOrgPool(orgID string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s/pools", c.Config.BaseURL, orgID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListOrgPools(orgID string) ([]params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s/pools", c.Config.BaseURL, orgID)
|
||||
|
||||
var response []params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetOrgPool(orgID, poolID string) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s/pools/%s", c.Config.BaseURL, orgID, poolID)
|
||||
|
||||
var response params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteOrgPool(orgID, poolID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s/pools/%s", c.Config.BaseURL, orgID, poolID)
|
||||
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateOrgPool(orgID, poolID string, param params.UpdatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s/pools/%s", c.Config.BaseURL, orgID, poolID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListOrgInstances(orgID string) ([]params.Instance, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/organizations/%s/instances", c.Config.BaseURL, orgID)
|
||||
|
||||
var response []params.Instance
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateMetricsToken() (string, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/metrics-token", c.Config.BaseURL)
|
||||
|
||||
type response struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
var t response
|
||||
resp, err := c.client.R().
|
||||
SetResult(&t).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return t.Token, nil
|
||||
}
|
||||
|
|
@ -1,179 +0,0 @@
|
|||
// Copyright 2022 Cloudbase Solutions SRL
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License. You may obtain
|
||||
// a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (c *Client) ListRepositories() ([]params.Repository, error) {
|
||||
var repos []params.Repository
|
||||
url := fmt.Sprintf("%s/api/v1/repositories", c.Config.BaseURL)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&repos).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return repos, nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateRepository(param params.CreateRepoParams) (params.Repository, error) {
|
||||
var response params.Repository
|
||||
url := fmt.Sprintf("%s/api/v1/repositories", c.Config.BaseURL)
|
||||
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return params.Repository{}, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Repository{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetRepository(repoID string) (params.Repository, error) {
|
||||
var response params.Repository
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s", c.Config.BaseURL, repoID)
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Repository{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteRepository(repoID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s", c.Config.BaseURL, repoID)
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateRepoPool(repoID string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s/pools", c.Config.BaseURL, repoID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Post(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListRepoPools(repoID string) ([]params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s/pools", c.Config.BaseURL, repoID)
|
||||
|
||||
var response []params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetRepoPool(repoID, poolID string) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s/pools/%s", c.Config.BaseURL, repoID, poolID)
|
||||
|
||||
var response params.Pool
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteRepoPool(repoID, poolID string) error {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s/pools/%s", c.Config.BaseURL, repoID, poolID)
|
||||
|
||||
resp, err := c.client.R().
|
||||
Delete(url)
|
||||
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateRepoPool(repoID, poolID string, param params.UpdatePoolParams) (params.Pool, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s/pools/%s", c.Config.BaseURL, repoID, poolID)
|
||||
|
||||
var response params.Pool
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Pool{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateRepo(repoID string, param params.UpdateEntityParams) (params.Repository, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s", c.Config.BaseURL, repoID)
|
||||
|
||||
var response params.Repository
|
||||
body, err := json.Marshal(param)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
resp, err := c.client.R().
|
||||
SetBody(body).
|
||||
SetResult(&response).
|
||||
Put(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return params.Repository{}, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *Client) ListRepoInstances(repoID string) ([]params.Instance, error) {
|
||||
url := fmt.Sprintf("%s/api/v1/repositories/%s/instances", c.Config.BaseURL, repoID)
|
||||
|
||||
var response []params.Instance
|
||||
resp, err := c.client.R().
|
||||
SetResult(&response).
|
||||
Get(url)
|
||||
if err := c.handleError(err, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ package cmd
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
apiClientCreds "github.com/cloudbase/garm/client/credentials"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/jedib0t/go-pretty/v6/table"
|
||||
|
|
@ -50,11 +51,12 @@ func init() {
|
|||
return errNeedsInitError
|
||||
}
|
||||
|
||||
creds, err := cli.ListCredentials()
|
||||
listCredsReq := apiClientCreds.NewListCredentialsParams()
|
||||
response, err := apiCli.Credentials.ListCredentials(listCredsReq, authToken)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
formatGithubCredentials(creds)
|
||||
formatGithubCredentials(response.Payload)
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue