Update generated swagger client code
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
This commit is contained in:
parent
98e415bf11
commit
db21fb6ea9
49 changed files with 7987 additions and 2 deletions
|
|
@ -9,6 +9,13 @@ definitions:
|
|||
alias: apiserver_params
|
||||
package: github.com/cloudbase/garm/apiserver/params
|
||||
type: APIErrorResponse
|
||||
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 +30,22 @@ 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
|
||||
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 +54,51 @@ 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
|
||||
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 +107,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 +161,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 +176,69 @@ 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
|
||||
/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 +291,381 @@ paths:
|
|||
summary: Get runner instance by name.
|
||||
tags:
|
||||
- instances
|
||||
/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
|
||||
|
|
|
|||
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
|
||||
}
|
||||
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,13 @@ import (
|
|||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/cloudbase/garm/client/credentials"
|
||||
"github.com/cloudbase/garm/client/first_run"
|
||||
"github.com/cloudbase/garm/client/instances"
|
||||
"github.com/cloudbase/garm/client/login"
|
||||
"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 +62,13 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI {
|
|||
|
||||
cli := new(GarmAPI)
|
||||
cli.Transport = transport
|
||||
cli.Credentials = credentials.New(transport, formats)
|
||||
cli.FirstRun = first_run.New(transport, formats)
|
||||
cli.Instances = instances.New(transport, formats)
|
||||
cli.Login = login.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 +114,20 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
|||
|
||||
// GarmAPI is a client for garm API
|
||||
type GarmAPI struct {
|
||||
Credentials credentials.ClientService
|
||||
|
||||
FirstRun first_run.ClientService
|
||||
|
||||
Instances instances.ClientService
|
||||
|
||||
Login login.ClientService
|
||||
|
||||
Organizations organizations.ClientService
|
||||
|
||||
Pools pools.ClientService
|
||||
|
||||
Providers providers.ClientService
|
||||
|
||||
Repositories repositories.ClientService
|
||||
|
||||
Transport runtime.ClientTransport
|
||||
|
|
@ -112,6 +136,12 @@ 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.FirstRun.SetTransport(transport)
|
||||
c.Instances.SetTransport(transport)
|
||||
c.Login.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/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
|
||||
}
|
||||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue