VMware vSphere Integrated Containers provider (#206)

* Add Virtual Kubelet provider for VIC

Initial virtual kubelet provider for VMware VIC.  This provider currently
handles creating and starting of a pod VM via the VIC portlayer and persona
server.  Image store handling via the VIC persona server.  This provider
currently requires the feature/wolfpack branch of VIC.

* Added pod stop and delete.  Also added node capacity.

Added the ability to stop and delete pod VMs via VIC.  Also retrieve
node capacity information from the VCH.

* Cleanup and readme file

Some file clean up and added a Readme.md markdown file for the VIC
provider.

* Cleaned up errors, added function comments, moved operation code

1. Cleaned up error handling.  Set standard for creating errors.
2. Added method prototype comments for all interface functions.
3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder.

* Add mocking code and unit tests for podcache, podcreator, and podstarter

Used the unit test framework used in VIC to handle assertions in the provider's
unit test.  Mocking code generated using OSS project mockery, which is compatible
with the testify assertion framework.

* Vendored packages for the VIC provider

Requires feature/wolfpack branch of VIC and a few specific commit sha of
projects used within VIC.

* Implementation of POD Stopper and Deleter unit tests (#4)

* Updated files for initial PR
This commit is contained in:
Loc Nguyen
2018-06-04 15:41:32 -07:00
committed by Ria Bhatia
parent 98a111e8b7
commit 513cebe7b7
6296 changed files with 1123685 additions and 8 deletions

View File

@@ -0,0 +1,160 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewCommitParams creates a new CommitParams object
// with the default values initialized.
func NewCommitParams() *CommitParams {
var ()
return &CommitParams{
timeout: cr.DefaultTimeout,
}
}
// NewCommitParamsWithTimeout creates a new CommitParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCommitParamsWithTimeout(timeout time.Duration) *CommitParams {
var ()
return &CommitParams{
timeout: timeout,
}
}
// NewCommitParamsWithContext creates a new CommitParams object
// with the default values initialized, and the ability to set a context for a request
func NewCommitParamsWithContext(ctx context.Context) *CommitParams {
var ()
return &CommitParams{
Context: ctx,
}
}
// NewCommitParamsWithHTTPClient creates a new CommitParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCommitParamsWithHTTPClient(client *http.Client) *CommitParams {
var ()
return &CommitParams{
HTTPClient: client,
}
}
/*CommitParams contains all the parameters to send to the API endpoint
for the commit operation typically these are written to a http.Request
*/
type CommitParams struct {
/*Handle*/
Handle string
/*WaitTime*/
WaitTime *int32
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the commit params
func (o *CommitParams) WithTimeout(timeout time.Duration) *CommitParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the commit params
func (o *CommitParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the commit params
func (o *CommitParams) WithContext(ctx context.Context) *CommitParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the commit params
func (o *CommitParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the commit params
func (o *CommitParams) WithHTTPClient(client *http.Client) *CommitParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the commit params
func (o *CommitParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the commit params
func (o *CommitParams) WithHandle(handle string) *CommitParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the commit params
func (o *CommitParams) SetHandle(handle string) {
o.Handle = handle
}
// WithWaitTime adds the waitTime to the commit params
func (o *CommitParams) WithWaitTime(waitTime *int32) *CommitParams {
o.SetWaitTime(waitTime)
return o
}
// SetWaitTime adds the waitTime to the commit params
func (o *CommitParams) SetWaitTime(waitTime *int32) {
o.WaitTime = waitTime
}
// WriteToRequest writes these params to a swagger request
func (o *CommitParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
if o.WaitTime != nil {
// query param wait_time
var qrWaitTime int32
if o.WaitTime != nil {
qrWaitTime = *o.WaitTime
}
qWaitTime := swag.FormatInt32(qrWaitTime)
if qWaitTime != "" {
if err := r.SetQueryParam("wait_time", qWaitTime); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,174 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// CommitReader is a Reader for the Commit structure.
type CommitReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CommitReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCommitOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewCommitNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewCommitConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewCommitDefault(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
}
}
// NewCommitOK creates a CommitOK with default headers values
func NewCommitOK() *CommitOK {
return &CommitOK{}
}
/*CommitOK handles this case with default header values.
OK
*/
type CommitOK struct {
}
func (o *CommitOK) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}][%d] commitOK ", 200)
}
func (o *CommitOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewCommitNotFound creates a CommitNotFound with default headers values
func NewCommitNotFound() *CommitNotFound {
return &CommitNotFound{}
}
/*CommitNotFound handles this case with default header values.
not found
*/
type CommitNotFound struct {
Payload *models.Error
}
func (o *CommitNotFound) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}][%d] commitNotFound %+v", 404, o.Payload)
}
func (o *CommitNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCommitConflict creates a CommitConflict with default headers values
func NewCommitConflict() *CommitConflict {
return &CommitConflict{}
}
/*CommitConflict handles this case with default header values.
conflict
*/
type CommitConflict struct {
Payload *models.Error
}
func (o *CommitConflict) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}][%d] commitConflict %+v", 409, o.Payload)
}
func (o *CommitConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCommitDefault creates a CommitDefault with default headers values
func NewCommitDefault(code int) *CommitDefault {
return &CommitDefault{
_statusCode: code,
}
}
/*CommitDefault handles this case with default header values.
Error
*/
type CommitDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the commit default response
func (o *CommitDefault) Code() int {
return o._statusCode
}
func (o *CommitDefault) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}][%d] Commit default %+v", o._statusCode, o.Payload)
}
func (o *CommitDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,209 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerRemoveParams creates a new ContainerRemoveParams object
// with the default values initialized.
func NewContainerRemoveParams() *ContainerRemoveParams {
var (
forceDefault = bool(false)
vDefault = bool(false)
)
return &ContainerRemoveParams{
Force: &forceDefault,
V: &vDefault,
timeout: cr.DefaultTimeout,
}
}
// NewContainerRemoveParamsWithTimeout creates a new ContainerRemoveParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerRemoveParamsWithTimeout(timeout time.Duration) *ContainerRemoveParams {
var (
forceDefault = bool(false)
vDefault = bool(false)
)
return &ContainerRemoveParams{
Force: &forceDefault,
V: &vDefault,
timeout: timeout,
}
}
// NewContainerRemoveParamsWithContext creates a new ContainerRemoveParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerRemoveParamsWithContext(ctx context.Context) *ContainerRemoveParams {
var (
forceDefault = bool(false)
vDefault = bool(false)
)
return &ContainerRemoveParams{
Force: &forceDefault,
V: &vDefault,
Context: ctx,
}
}
// NewContainerRemoveParamsWithHTTPClient creates a new ContainerRemoveParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerRemoveParamsWithHTTPClient(client *http.Client) *ContainerRemoveParams {
var (
forceDefault = bool(false)
vDefault = bool(false)
)
return &ContainerRemoveParams{
Force: &forceDefault,
V: &vDefault,
HTTPClient: client,
}
}
/*ContainerRemoveParams contains all the parameters to send to the API endpoint
for the container remove operation typically these are written to a http.Request
*/
type ContainerRemoveParams struct {
/*Force*/
Force *bool
/*ID*/
ID string
/*V*/
V *bool
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container remove params
func (o *ContainerRemoveParams) WithTimeout(timeout time.Duration) *ContainerRemoveParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container remove params
func (o *ContainerRemoveParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container remove params
func (o *ContainerRemoveParams) WithContext(ctx context.Context) *ContainerRemoveParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container remove params
func (o *ContainerRemoveParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container remove params
func (o *ContainerRemoveParams) WithHTTPClient(client *http.Client) *ContainerRemoveParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container remove params
func (o *ContainerRemoveParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithForce adds the force to the container remove params
func (o *ContainerRemoveParams) WithForce(force *bool) *ContainerRemoveParams {
o.SetForce(force)
return o
}
// SetForce adds the force to the container remove params
func (o *ContainerRemoveParams) SetForce(force *bool) {
o.Force = force
}
// WithID adds the id to the container remove params
func (o *ContainerRemoveParams) WithID(id string) *ContainerRemoveParams {
o.SetID(id)
return o
}
// SetID adds the id to the container remove params
func (o *ContainerRemoveParams) SetID(id string) {
o.ID = id
}
// WithV adds the v to the container remove params
func (o *ContainerRemoveParams) WithV(v *bool) *ContainerRemoveParams {
o.SetV(v)
return o
}
// SetV adds the v to the container remove params
func (o *ContainerRemoveParams) SetV(v *bool) {
o.V = v
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerRemoveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Force != nil {
// query param force
var qrForce bool
if o.Force != nil {
qrForce = *o.Force
}
qForce := swag.FormatBool(qrForce)
if qForce != "" {
if err := r.SetQueryParam("force", qForce); err != nil {
return err
}
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if o.V != nil {
// query param v
var qrV bool
if o.V != nil {
qrV = *o.V
}
qV := swag.FormatBool(qrV)
if qV != "" {
if err := r.SetQueryParam("v", qV); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,230 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerRemoveReader is a Reader for the ContainerRemove structure.
type ContainerRemoveReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerRemoveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerRemoveOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewContainerRemoveBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewContainerRemoveNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewContainerRemoveConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerRemoveInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewContainerRemoveDefault(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
}
}
// NewContainerRemoveOK creates a ContainerRemoveOK with default headers values
func NewContainerRemoveOK() *ContainerRemoveOK {
return &ContainerRemoveOK{}
}
/*ContainerRemoveOK handles this case with default header values.
OK
*/
type ContainerRemoveOK struct {
}
func (o *ContainerRemoveOK) Error() string {
return fmt.Sprintf("[DELETE /containers/{id}][%d] containerRemoveOK ", 200)
}
func (o *ContainerRemoveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerRemoveBadRequest creates a ContainerRemoveBadRequest with default headers values
func NewContainerRemoveBadRequest() *ContainerRemoveBadRequest {
return &ContainerRemoveBadRequest{}
}
/*ContainerRemoveBadRequest handles this case with default header values.
bad parameter
*/
type ContainerRemoveBadRequest struct {
}
func (o *ContainerRemoveBadRequest) Error() string {
return fmt.Sprintf("[DELETE /containers/{id}][%d] containerRemoveBadRequest ", 400)
}
func (o *ContainerRemoveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerRemoveNotFound creates a ContainerRemoveNotFound with default headers values
func NewContainerRemoveNotFound() *ContainerRemoveNotFound {
return &ContainerRemoveNotFound{}
}
/*ContainerRemoveNotFound handles this case with default header values.
no such container
*/
type ContainerRemoveNotFound struct {
}
func (o *ContainerRemoveNotFound) Error() string {
return fmt.Sprintf("[DELETE /containers/{id}][%d] containerRemoveNotFound ", 404)
}
func (o *ContainerRemoveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerRemoveConflict creates a ContainerRemoveConflict with default headers values
func NewContainerRemoveConflict() *ContainerRemoveConflict {
return &ContainerRemoveConflict{}
}
/*ContainerRemoveConflict handles this case with default header values.
conflict
*/
type ContainerRemoveConflict struct {
Payload *models.Error
}
func (o *ContainerRemoveConflict) Error() string {
return fmt.Sprintf("[DELETE /containers/{id}][%d] containerRemoveConflict %+v", 409, o.Payload)
}
func (o *ContainerRemoveConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerRemoveInternalServerError creates a ContainerRemoveInternalServerError with default headers values
func NewContainerRemoveInternalServerError() *ContainerRemoveInternalServerError {
return &ContainerRemoveInternalServerError{}
}
/*ContainerRemoveInternalServerError handles this case with default header values.
server error
*/
type ContainerRemoveInternalServerError struct {
Payload *models.Error
}
func (o *ContainerRemoveInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /containers/{id}][%d] containerRemoveInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerRemoveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerRemoveDefault creates a ContainerRemoveDefault with default headers values
func NewContainerRemoveDefault(code int) *ContainerRemoveDefault {
return &ContainerRemoveDefault{
_statusCode: code,
}
}
/*ContainerRemoveDefault handles this case with default header values.
Error
*/
type ContainerRemoveDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the container remove default response
func (o *ContainerRemoveDefault) Code() int {
return o._statusCode
}
func (o *ContainerRemoveDefault) Error() string {
return fmt.Sprintf("[DELETE /containers/{id}][%d] ContainerRemove default %+v", o._statusCode, o.Payload)
}
func (o *ContainerRemoveDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,155 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerRenameParams creates a new ContainerRenameParams object
// with the default values initialized.
func NewContainerRenameParams() *ContainerRenameParams {
var ()
return &ContainerRenameParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerRenameParamsWithTimeout creates a new ContainerRenameParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerRenameParamsWithTimeout(timeout time.Duration) *ContainerRenameParams {
var ()
return &ContainerRenameParams{
timeout: timeout,
}
}
// NewContainerRenameParamsWithContext creates a new ContainerRenameParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerRenameParamsWithContext(ctx context.Context) *ContainerRenameParams {
var ()
return &ContainerRenameParams{
Context: ctx,
}
}
// NewContainerRenameParamsWithHTTPClient creates a new ContainerRenameParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerRenameParamsWithHTTPClient(client *http.Client) *ContainerRenameParams {
var ()
return &ContainerRenameParams{
HTTPClient: client,
}
}
/*ContainerRenameParams contains all the parameters to send to the API endpoint
for the container rename operation typically these are written to a http.Request
*/
type ContainerRenameParams struct {
/*Handle*/
Handle string
/*Name
New name for the container
*/
Name string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container rename params
func (o *ContainerRenameParams) WithTimeout(timeout time.Duration) *ContainerRenameParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container rename params
func (o *ContainerRenameParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container rename params
func (o *ContainerRenameParams) WithContext(ctx context.Context) *ContainerRenameParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container rename params
func (o *ContainerRenameParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container rename params
func (o *ContainerRenameParams) WithHTTPClient(client *http.Client) *ContainerRenameParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container rename params
func (o *ContainerRenameParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the container rename params
func (o *ContainerRenameParams) WithHandle(handle string) *ContainerRenameParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the container rename params
func (o *ContainerRenameParams) SetHandle(handle string) {
o.Handle = handle
}
// WithName adds the name to the container rename params
func (o *ContainerRenameParams) WithName(name string) *ContainerRenameParams {
o.SetName(name)
return o
}
// SetName adds the name to the container rename params
func (o *ContainerRenameParams) SetName(name string) {
o.Name = name
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerRenameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
// query param name
qrName := o.Name
qName := qrName
if qName != "" {
if err := r.SetQueryParam("name", qName); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,171 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerRenameReader is a Reader for the ContainerRename structure.
type ContainerRenameReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerRenameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerRenameOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerRenameNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewContainerRenameConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerRenameInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerRenameOK creates a ContainerRenameOK with default headers values
func NewContainerRenameOK() *ContainerRenameOK {
return &ContainerRenameOK{}
}
/*ContainerRenameOK handles this case with default header values.
OK
*/
type ContainerRenameOK struct {
Payload string
}
func (o *ContainerRenameOK) Error() string {
return fmt.Sprintf("[PATCH /containers/{handle}/name][%d] containerRenameOK %+v", 200, o.Payload)
}
func (o *ContainerRenameOK) 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
}
// NewContainerRenameNotFound creates a ContainerRenameNotFound with default headers values
func NewContainerRenameNotFound() *ContainerRenameNotFound {
return &ContainerRenameNotFound{}
}
/*ContainerRenameNotFound handles this case with default header values.
no such container
*/
type ContainerRenameNotFound struct {
Payload *models.Error
}
func (o *ContainerRenameNotFound) Error() string {
return fmt.Sprintf("[PATCH /containers/{handle}/name][%d] containerRenameNotFound %+v", 404, o.Payload)
}
func (o *ContainerRenameNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerRenameConflict creates a ContainerRenameConflict with default headers values
func NewContainerRenameConflict() *ContainerRenameConflict {
return &ContainerRenameConflict{}
}
/*ContainerRenameConflict handles this case with default header values.
conflict, name already assigned
*/
type ContainerRenameConflict struct {
Payload *models.Error
}
func (o *ContainerRenameConflict) Error() string {
return fmt.Sprintf("[PATCH /containers/{handle}/name][%d] containerRenameConflict %+v", 409, o.Payload)
}
func (o *ContainerRenameConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerRenameInternalServerError creates a ContainerRenameInternalServerError with default headers values
func NewContainerRenameInternalServerError() *ContainerRenameInternalServerError {
return &ContainerRenameInternalServerError{}
}
/*ContainerRenameInternalServerError handles this case with default header values.
server error
*/
type ContainerRenameInternalServerError struct {
Payload *models.Error
}
func (o *ContainerRenameInternalServerError) Error() string {
return fmt.Sprintf("[PATCH /containers/{handle}/name][%d] containerRenameInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerRenameInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,153 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerSignalParams creates a new ContainerSignalParams object
// with the default values initialized.
func NewContainerSignalParams() *ContainerSignalParams {
var ()
return &ContainerSignalParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerSignalParamsWithTimeout creates a new ContainerSignalParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerSignalParamsWithTimeout(timeout time.Duration) *ContainerSignalParams {
var ()
return &ContainerSignalParams{
timeout: timeout,
}
}
// NewContainerSignalParamsWithContext creates a new ContainerSignalParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerSignalParamsWithContext(ctx context.Context) *ContainerSignalParams {
var ()
return &ContainerSignalParams{
Context: ctx,
}
}
// NewContainerSignalParamsWithHTTPClient creates a new ContainerSignalParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerSignalParamsWithHTTPClient(client *http.Client) *ContainerSignalParams {
var ()
return &ContainerSignalParams{
HTTPClient: client,
}
}
/*ContainerSignalParams contains all the parameters to send to the API endpoint
for the container signal operation typically these are written to a http.Request
*/
type ContainerSignalParams struct {
/*ID*/
ID string
/*Signal*/
Signal int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container signal params
func (o *ContainerSignalParams) WithTimeout(timeout time.Duration) *ContainerSignalParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container signal params
func (o *ContainerSignalParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container signal params
func (o *ContainerSignalParams) WithContext(ctx context.Context) *ContainerSignalParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container signal params
func (o *ContainerSignalParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container signal params
func (o *ContainerSignalParams) WithHTTPClient(client *http.Client) *ContainerSignalParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container signal params
func (o *ContainerSignalParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the container signal params
func (o *ContainerSignalParams) WithID(id string) *ContainerSignalParams {
o.SetID(id)
return o
}
// SetID adds the id to the container signal params
func (o *ContainerSignalParams) SetID(id string) {
o.ID = id
}
// WithSignal adds the signal to the container signal params
func (o *ContainerSignalParams) WithSignal(signal int64) *ContainerSignalParams {
o.SetSignal(signal)
return o
}
// SetSignal adds the signal to the container signal params
func (o *ContainerSignalParams) SetSignal(signal int64) {
o.Signal = signal
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerSignalParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// query param signal
qrSignal := o.Signal
qSignal := swag.FormatInt64(qrSignal)
if qSignal != "" {
if err := r.SetQueryParam("signal", qSignal); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,129 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerSignalReader is a Reader for the ContainerSignal structure.
type ContainerSignalReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerSignalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerSignalOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerSignalNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerSignalInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerSignalOK creates a ContainerSignalOK with default headers values
func NewContainerSignalOK() *ContainerSignalOK {
return &ContainerSignalOK{}
}
/*ContainerSignalOK handles this case with default header values.
OK
*/
type ContainerSignalOK struct {
}
func (o *ContainerSignalOK) Error() string {
return fmt.Sprintf("[POST /containers/{id}/signal][%d] containerSignalOK ", 200)
}
func (o *ContainerSignalOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerSignalNotFound creates a ContainerSignalNotFound with default headers values
func NewContainerSignalNotFound() *ContainerSignalNotFound {
return &ContainerSignalNotFound{}
}
/*ContainerSignalNotFound handles this case with default header values.
Container not found
*/
type ContainerSignalNotFound struct {
Payload *models.Error
}
func (o *ContainerSignalNotFound) Error() string {
return fmt.Sprintf("[POST /containers/{id}/signal][%d] containerSignalNotFound %+v", 404, o.Payload)
}
func (o *ContainerSignalNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerSignalInternalServerError creates a ContainerSignalInternalServerError with default headers values
func NewContainerSignalInternalServerError() *ContainerSignalInternalServerError {
return &ContainerSignalInternalServerError{}
}
/*ContainerSignalInternalServerError handles this case with default header values.
Failed to signal container
*/
type ContainerSignalInternalServerError struct {
Payload *models.Error
}
func (o *ContainerSignalInternalServerError) Error() string {
return fmt.Sprintf("[POST /containers/{id}/signal][%d] containerSignalInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerSignalInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,153 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerWaitParams creates a new ContainerWaitParams object
// with the default values initialized.
func NewContainerWaitParams() *ContainerWaitParams {
var ()
return &ContainerWaitParams{
requestTimeout: cr.DefaultTimeout,
}
}
// NewContainerWaitParamsWithTimeout creates a new ContainerWaitParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerWaitParamsWithTimeout(timeout time.Duration) *ContainerWaitParams {
var ()
return &ContainerWaitParams{
requestTimeout: timeout,
}
}
// NewContainerWaitParamsWithContext creates a new ContainerWaitParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerWaitParamsWithContext(ctx context.Context) *ContainerWaitParams {
var ()
return &ContainerWaitParams{
Context: ctx,
}
}
// NewContainerWaitParamsWithHTTPClient creates a new ContainerWaitParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerWaitParamsWithHTTPClient(client *http.Client) *ContainerWaitParams {
var ()
return &ContainerWaitParams{
HTTPClient: client,
}
}
/*ContainerWaitParams contains all the parameters to send to the API endpoint
for the container wait operation typically these are written to a http.Request
*/
type ContainerWaitParams struct {
/*ID*/
ID string
/*Timeout*/
Timeout int64
requestTimeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithRequestTimeout adds the timeout to the container wait params
func (o *ContainerWaitParams) WithRequestTimeout(timeout time.Duration) *ContainerWaitParams {
o.SetRequestTimeout(timeout)
return o
}
// SetRequestTimeout adds the timeout to the container wait params
func (o *ContainerWaitParams) SetRequestTimeout(timeout time.Duration) {
o.requestTimeout = timeout
}
// WithContext adds the context to the container wait params
func (o *ContainerWaitParams) WithContext(ctx context.Context) *ContainerWaitParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container wait params
func (o *ContainerWaitParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container wait params
func (o *ContainerWaitParams) WithHTTPClient(client *http.Client) *ContainerWaitParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container wait params
func (o *ContainerWaitParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the container wait params
func (o *ContainerWaitParams) WithID(id string) *ContainerWaitParams {
o.SetID(id)
return o
}
// SetID adds the id to the container wait params
func (o *ContainerWaitParams) SetID(id string) {
o.ID = id
}
// WithTimeout adds the timeout to the container wait params
func (o *ContainerWaitParams) WithTimeout(timeout int64) *ContainerWaitParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container wait params
func (o *ContainerWaitParams) SetTimeout(timeout int64) {
o.Timeout = timeout
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerWaitParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.requestTimeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// query param timeout
qrTimeout := o.Timeout
qTimeout := swag.FormatInt64(qrTimeout)
if qTimeout != "" {
if err := r.SetQueryParam("timeout", qTimeout); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerWaitReader is a Reader for the ContainerWait structure.
type ContainerWaitReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerWaitReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerWaitOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerWaitNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerWaitInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerWaitOK creates a ContainerWaitOK with default headers values
func NewContainerWaitOK() *ContainerWaitOK {
return &ContainerWaitOK{}
}
/*ContainerWaitOK handles this case with default header values.
OK
*/
type ContainerWaitOK struct {
Payload *models.ContainerInfo
}
func (o *ContainerWaitOK) Error() string {
return fmt.Sprintf("[GET /containers/{id}/wait][%d] containerWaitOK %+v", 200, o.Payload)
}
func (o *ContainerWaitOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ContainerInfo)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerWaitNotFound creates a ContainerWaitNotFound with default headers values
func NewContainerWaitNotFound() *ContainerWaitNotFound {
return &ContainerWaitNotFound{}
}
/*ContainerWaitNotFound handles this case with default header values.
Container not found
*/
type ContainerWaitNotFound struct {
Payload *models.Error
}
func (o *ContainerWaitNotFound) Error() string {
return fmt.Sprintf("[GET /containers/{id}/wait][%d] containerWaitNotFound %+v", 404, o.Payload)
}
func (o *ContainerWaitNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerWaitInternalServerError creates a ContainerWaitInternalServerError with default headers values
func NewContainerWaitInternalServerError() *ContainerWaitInternalServerError {
return &ContainerWaitInternalServerError{}
}
/*ContainerWaitInternalServerError handles this case with default header values.
Failed to wait on Container
*/
type ContainerWaitInternalServerError struct {
Payload *models.Error
}
func (o *ContainerWaitInternalServerError) Error() string {
return fmt.Sprintf("[GET /containers/{id}/wait][%d] containerWaitInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerWaitInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,402 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new containers API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for containers API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
Commit Commit and close a container handle
*/
func (a *Client) Commit(params *CommitParams) (*CommitOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCommitParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Commit",
Method: "PUT",
PathPattern: "/containers/{handle}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &CommitReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*CommitOK), nil
}
/*
ContainerRemove Remove a container from existence
*/
func (a *Client) ContainerRemove(params *ContainerRemoveParams) (*ContainerRemoveOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerRemoveParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerRemove",
Method: "DELETE",
PathPattern: "/containers/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerRemoveReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerRemoveOK), nil
}
/*
ContainerRename Rename a container to the new name
*/
func (a *Client) ContainerRename(params *ContainerRenameParams) (*ContainerRenameOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerRenameParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerRename",
Method: "PATCH",
PathPattern: "/containers/{handle}/name",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerRenameReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerRenameOK), nil
}
/*
ContainerSignal signals a running container
Sends a signal to a container by id
*/
func (a *Client) ContainerSignal(params *ContainerSignalParams) (*ContainerSignalOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerSignalParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerSignal",
Method: "POST",
PathPattern: "/containers/{id}/signal",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerSignalReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerSignalOK), nil
}
/*
ContainerWait Wait for the container to stop
*/
func (a *Client) ContainerWait(params *ContainerWaitParams) (*ContainerWaitOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerWaitParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerWait",
Method: "GET",
PathPattern: "/containers/{id}/wait",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerWaitReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerWaitOK), nil
}
/*
Create initiates a container create operation
Initiates a container create operation
*/
func (a *Client) Create(params *CreateParams) (*CreateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Create",
Method: "POST",
PathPattern: "/containers",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*CreateOK), nil
}
/*
Get Get a container handle
*/
func (a *Client) Get(params *GetParams) (*GetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Get",
Method: "GET",
PathPattern: "/containers/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetOK), nil
}
/*
GetContainerInfo Gets information about a container by id
*/
func (a *Client) GetContainerInfo(params *GetContainerInfoParams) (*GetContainerInfoOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetContainerInfoParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetContainerInfo",
Method: "GET",
PathPattern: "/containers/info/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetContainerInfoReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetContainerInfoOK), nil
}
/*
GetContainerList Gets a list of all containers
*/
func (a *Client) GetContainerList(params *GetContainerListParams) (*GetContainerListOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetContainerListParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetContainerList",
Method: "GET",
PathPattern: "/containers/list",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetContainerListReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetContainerListOK), nil
}
/*
GetContainerLogs gets the container logs
Gets the container logs by id
*/
func (a *Client) GetContainerLogs(params *GetContainerLogsParams, writer io.Writer) (*GetContainerLogsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetContainerLogsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetContainerLogs",
Method: "GET",
PathPattern: "/containers/{id}/logs",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetContainerLogsReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetContainerLogsOK), nil
}
/*
GetContainerStats gets the container stats
Gets the container stats by id
*/
func (a *Client) GetContainerStats(params *GetContainerStatsParams, writer io.Writer) (*GetContainerStatsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetContainerStatsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetContainerStats",
Method: "GET",
PathPattern: "/containers/{id}/stats",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetContainerStatsReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetContainerStatsOK), nil
}
/*
GetState Get the current state of the a container
*/
func (a *Client) GetState(params *GetStateParams) (*GetStateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetStateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetState",
Method: "GET",
PathPattern: "/containers/{handle}/state",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetStateReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetStateOK), nil
}
/*
StateChange Changes the state of a container
*/
func (a *Client) StateChange(params *StateChangeParams) (*StateChangeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewStateChangeParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "StateChange",
Method: "PUT",
PathPattern: "/containers/{handle}/state",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &StateChangeReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*StateChangeOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,164 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewCreateParams creates a new CreateParams object
// with the default values initialized.
func NewCreateParams() *CreateParams {
var ()
return &CreateParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateParamsWithTimeout creates a new CreateParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCreateParamsWithTimeout(timeout time.Duration) *CreateParams {
var ()
return &CreateParams{
timeout: timeout,
}
}
// NewCreateParamsWithContext creates a new CreateParams object
// with the default values initialized, and the ability to set a context for a request
func NewCreateParamsWithContext(ctx context.Context) *CreateParams {
var ()
return &CreateParams{
Context: ctx,
}
}
// NewCreateParamsWithHTTPClient creates a new CreateParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCreateParamsWithHTTPClient(client *http.Client) *CreateParams {
var ()
return &CreateParams{
HTTPClient: client,
}
}
/*CreateParams contains all the parameters to send to the API endpoint
for the create operation typically these are written to a http.Request
*/
type CreateParams struct {
/*CreateConfig*/
CreateConfig *models.ContainerCreateConfig
/*Name*/
Name *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the create params
func (o *CreateParams) WithTimeout(timeout time.Duration) *CreateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create params
func (o *CreateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create params
func (o *CreateParams) WithContext(ctx context.Context) *CreateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create params
func (o *CreateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create params
func (o *CreateParams) WithHTTPClient(client *http.Client) *CreateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create params
func (o *CreateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCreateConfig adds the createConfig to the create params
func (o *CreateParams) WithCreateConfig(createConfig *models.ContainerCreateConfig) *CreateParams {
o.SetCreateConfig(createConfig)
return o
}
// SetCreateConfig adds the createConfig to the create params
func (o *CreateParams) SetCreateConfig(createConfig *models.ContainerCreateConfig) {
o.CreateConfig = createConfig
}
// WithName adds the name to the create params
func (o *CreateParams) WithName(name *string) *CreateParams {
o.SetName(name)
return o
}
// SetName adds the name to the create params
func (o *CreateParams) SetName(name *string) {
o.Name = name
}
// WriteToRequest writes these params to a swagger request
func (o *CreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.CreateConfig == nil {
o.CreateConfig = new(models.ContainerCreateConfig)
}
if err := r.SetBodyParam(o.CreateConfig); err != nil {
return err
}
if o.Name != nil {
// query param name
var qrName string
if o.Name != nil {
qrName = *o.Name
}
qName := qrName
if qName != "" {
if err := r.SetQueryParam("name", qName); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,101 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// CreateReader is a Reader for the Create structure.
type CreateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewCreateNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewCreateOK creates a CreateOK with default headers values
func NewCreateOK() *CreateOK {
return &CreateOK{}
}
/*CreateOK handles this case with default header values.
OK
*/
type CreateOK struct {
Payload *models.ContainerCreatedInfo
}
func (o *CreateOK) Error() string {
return fmt.Sprintf("[POST /containers][%d] createOK %+v", 200, o.Payload)
}
func (o *CreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ContainerCreatedInfo)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateNotFound creates a CreateNotFound with default headers values
func NewCreateNotFound() *CreateNotFound {
return &CreateNotFound{}
}
/*CreateNotFound handles this case with default header values.
Create failed
*/
type CreateNotFound struct {
Payload *models.Error
}
func (o *CreateNotFound) Error() string {
return fmt.Sprintf("[POST /containers][%d] createNotFound %+v", 404, o.Payload)
}
func (o *CreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetContainerInfoParams creates a new GetContainerInfoParams object
// with the default values initialized.
func NewGetContainerInfoParams() *GetContainerInfoParams {
var ()
return &GetContainerInfoParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetContainerInfoParamsWithTimeout creates a new GetContainerInfoParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetContainerInfoParamsWithTimeout(timeout time.Duration) *GetContainerInfoParams {
var ()
return &GetContainerInfoParams{
timeout: timeout,
}
}
// NewGetContainerInfoParamsWithContext creates a new GetContainerInfoParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetContainerInfoParamsWithContext(ctx context.Context) *GetContainerInfoParams {
var ()
return &GetContainerInfoParams{
Context: ctx,
}
}
// NewGetContainerInfoParamsWithHTTPClient creates a new GetContainerInfoParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetContainerInfoParamsWithHTTPClient(client *http.Client) *GetContainerInfoParams {
var ()
return &GetContainerInfoParams{
HTTPClient: client,
}
}
/*GetContainerInfoParams contains all the parameters to send to the API endpoint
for the get container info operation typically these are written to a http.Request
*/
type GetContainerInfoParams struct {
/*ID*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get container info params
func (o *GetContainerInfoParams) WithTimeout(timeout time.Duration) *GetContainerInfoParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get container info params
func (o *GetContainerInfoParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get container info params
func (o *GetContainerInfoParams) WithContext(ctx context.Context) *GetContainerInfoParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get container info params
func (o *GetContainerInfoParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get container info params
func (o *GetContainerInfoParams) WithHTTPClient(client *http.Client) *GetContainerInfoParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get container info params
func (o *GetContainerInfoParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get container info params
func (o *GetContainerInfoParams) WithID(id string) *GetContainerInfoParams {
o.SetID(id)
return o
}
// SetID adds the id to the get container info params
func (o *GetContainerInfoParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetContainerInfoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetContainerInfoReader is a Reader for the GetContainerInfo structure.
type GetContainerInfoReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetContainerInfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContainerInfoOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetContainerInfoNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetContainerInfoInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetContainerInfoOK creates a GetContainerInfoOK with default headers values
func NewGetContainerInfoOK() *GetContainerInfoOK {
return &GetContainerInfoOK{}
}
/*GetContainerInfoOK handles this case with default header values.
OK
*/
type GetContainerInfoOK struct {
Payload *models.ContainerInfo
}
func (o *GetContainerInfoOK) Error() string {
return fmt.Sprintf("[GET /containers/info/{id}][%d] getContainerInfoOK %+v", 200, o.Payload)
}
func (o *GetContainerInfoOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ContainerInfo)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetContainerInfoNotFound creates a GetContainerInfoNotFound with default headers values
func NewGetContainerInfoNotFound() *GetContainerInfoNotFound {
return &GetContainerInfoNotFound{}
}
/*GetContainerInfoNotFound handles this case with default header values.
not found
*/
type GetContainerInfoNotFound struct {
Payload *models.Error
}
func (o *GetContainerInfoNotFound) Error() string {
return fmt.Sprintf("[GET /containers/info/{id}][%d] getContainerInfoNotFound %+v", 404, o.Payload)
}
func (o *GetContainerInfoNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetContainerInfoInternalServerError creates a GetContainerInfoInternalServerError with default headers values
func NewGetContainerInfoInternalServerError() *GetContainerInfoInternalServerError {
return &GetContainerInfoInternalServerError{}
}
/*GetContainerInfoInternalServerError handles this case with default header values.
server error
*/
type GetContainerInfoInternalServerError struct {
Payload *models.Error
}
func (o *GetContainerInfoInternalServerError) Error() string {
return fmt.Sprintf("[GET /containers/info/{id}][%d] getContainerInfoInternalServerError %+v", 500, o.Payload)
}
func (o *GetContainerInfoInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,142 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetContainerListParams creates a new GetContainerListParams object
// with the default values initialized.
func NewGetContainerListParams() *GetContainerListParams {
var ()
return &GetContainerListParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetContainerListParamsWithTimeout creates a new GetContainerListParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetContainerListParamsWithTimeout(timeout time.Duration) *GetContainerListParams {
var ()
return &GetContainerListParams{
timeout: timeout,
}
}
// NewGetContainerListParamsWithContext creates a new GetContainerListParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetContainerListParamsWithContext(ctx context.Context) *GetContainerListParams {
var ()
return &GetContainerListParams{
Context: ctx,
}
}
// NewGetContainerListParamsWithHTTPClient creates a new GetContainerListParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetContainerListParamsWithHTTPClient(client *http.Client) *GetContainerListParams {
var ()
return &GetContainerListParams{
HTTPClient: client,
}
}
/*GetContainerListParams contains all the parameters to send to the API endpoint
for the get container list operation typically these are written to a http.Request
*/
type GetContainerListParams struct {
/*All*/
All *bool
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get container list params
func (o *GetContainerListParams) WithTimeout(timeout time.Duration) *GetContainerListParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get container list params
func (o *GetContainerListParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get container list params
func (o *GetContainerListParams) WithContext(ctx context.Context) *GetContainerListParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get container list params
func (o *GetContainerListParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get container list params
func (o *GetContainerListParams) WithHTTPClient(client *http.Client) *GetContainerListParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get container list params
func (o *GetContainerListParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAll adds the all to the get container list params
func (o *GetContainerListParams) WithAll(all *bool) *GetContainerListParams {
o.SetAll(all)
return o
}
// SetAll adds the all to the get container list params
func (o *GetContainerListParams) SetAll(all *bool) {
o.All = all
}
// WriteToRequest writes these params to a swagger request
func (o *GetContainerListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.All != nil {
// query param all
var qrAll bool
if o.All != nil {
qrAll = *o.All
}
qAll := swag.FormatBool(qrAll)
if qAll != "" {
if err := r.SetQueryParam("all", qAll); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,99 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetContainerListReader is a Reader for the GetContainerList structure.
type GetContainerListReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetContainerListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContainerListOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewGetContainerListInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetContainerListOK creates a GetContainerListOK with default headers values
func NewGetContainerListOK() *GetContainerListOK {
return &GetContainerListOK{}
}
/*GetContainerListOK handles this case with default header values.
OK
*/
type GetContainerListOK struct {
Payload []*models.ContainerInfo
}
func (o *GetContainerListOK) Error() string {
return fmt.Sprintf("[GET /containers/list][%d] getContainerListOK %+v", 200, o.Payload)
}
func (o *GetContainerListOK) 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
}
// NewGetContainerListInternalServerError creates a GetContainerListInternalServerError with default headers values
func NewGetContainerListInternalServerError() *GetContainerListInternalServerError {
return &GetContainerListInternalServerError{}
}
/*GetContainerListInternalServerError handles this case with default header values.
server error
*/
type GetContainerListInternalServerError struct {
Payload *models.Error
}
func (o *GetContainerListInternalServerError) Error() string {
return fmt.Sprintf("[GET /containers/list][%d] getContainerListInternalServerError %+v", 500, o.Payload)
}
func (o *GetContainerListInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,296 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetContainerLogsParams creates a new GetContainerLogsParams object
// with the default values initialized.
func NewGetContainerLogsParams() *GetContainerLogsParams {
var (
followDefault = bool(false)
timestampDefault = bool(false)
)
return &GetContainerLogsParams{
Follow: &followDefault,
Timestamp: &timestampDefault,
timeout: cr.DefaultTimeout,
}
}
// NewGetContainerLogsParamsWithTimeout creates a new GetContainerLogsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetContainerLogsParamsWithTimeout(timeout time.Duration) *GetContainerLogsParams {
var (
followDefault = bool(false)
timestampDefault = bool(false)
)
return &GetContainerLogsParams{
Follow: &followDefault,
Timestamp: &timestampDefault,
timeout: timeout,
}
}
// NewGetContainerLogsParamsWithContext creates a new GetContainerLogsParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetContainerLogsParamsWithContext(ctx context.Context) *GetContainerLogsParams {
var (
followDefault = bool(false)
timestampDefault = bool(false)
)
return &GetContainerLogsParams{
Follow: &followDefault,
Timestamp: &timestampDefault,
Context: ctx,
}
}
// NewGetContainerLogsParamsWithHTTPClient creates a new GetContainerLogsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetContainerLogsParamsWithHTTPClient(client *http.Client) *GetContainerLogsParams {
var (
followDefault = bool(false)
timestampDefault = bool(false)
)
return &GetContainerLogsParams{
Follow: &followDefault,
Timestamp: &timestampDefault,
HTTPClient: client,
}
}
/*GetContainerLogsParams contains all the parameters to send to the API endpoint
for the get container logs operation typically these are written to a http.Request
*/
type GetContainerLogsParams struct {
/*Deadline*/
Deadline *int64
/*Follow*/
Follow *bool
/*ID*/
ID string
/*Since*/
Since *int64
/*Taillines*/
Taillines *int64
/*Timestamp*/
Timestamp *bool
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get container logs params
func (o *GetContainerLogsParams) WithTimeout(timeout time.Duration) *GetContainerLogsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get container logs params
func (o *GetContainerLogsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get container logs params
func (o *GetContainerLogsParams) WithContext(ctx context.Context) *GetContainerLogsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get container logs params
func (o *GetContainerLogsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get container logs params
func (o *GetContainerLogsParams) WithHTTPClient(client *http.Client) *GetContainerLogsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get container logs params
func (o *GetContainerLogsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithDeadline adds the deadline to the get container logs params
func (o *GetContainerLogsParams) WithDeadline(deadline *int64) *GetContainerLogsParams {
o.SetDeadline(deadline)
return o
}
// SetDeadline adds the deadline to the get container logs params
func (o *GetContainerLogsParams) SetDeadline(deadline *int64) {
o.Deadline = deadline
}
// WithFollow adds the follow to the get container logs params
func (o *GetContainerLogsParams) WithFollow(follow *bool) *GetContainerLogsParams {
o.SetFollow(follow)
return o
}
// SetFollow adds the follow to the get container logs params
func (o *GetContainerLogsParams) SetFollow(follow *bool) {
o.Follow = follow
}
// WithID adds the id to the get container logs params
func (o *GetContainerLogsParams) WithID(id string) *GetContainerLogsParams {
o.SetID(id)
return o
}
// SetID adds the id to the get container logs params
func (o *GetContainerLogsParams) SetID(id string) {
o.ID = id
}
// WithSince adds the since to the get container logs params
func (o *GetContainerLogsParams) WithSince(since *int64) *GetContainerLogsParams {
o.SetSince(since)
return o
}
// SetSince adds the since to the get container logs params
func (o *GetContainerLogsParams) SetSince(since *int64) {
o.Since = since
}
// WithTaillines adds the taillines to the get container logs params
func (o *GetContainerLogsParams) WithTaillines(taillines *int64) *GetContainerLogsParams {
o.SetTaillines(taillines)
return o
}
// SetTaillines adds the taillines to the get container logs params
func (o *GetContainerLogsParams) SetTaillines(taillines *int64) {
o.Taillines = taillines
}
// WithTimestamp adds the timestamp to the get container logs params
func (o *GetContainerLogsParams) WithTimestamp(timestamp *bool) *GetContainerLogsParams {
o.SetTimestamp(timestamp)
return o
}
// SetTimestamp adds the timestamp to the get container logs params
func (o *GetContainerLogsParams) SetTimestamp(timestamp *bool) {
o.Timestamp = timestamp
}
// WriteToRequest writes these params to a swagger request
func (o *GetContainerLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Deadline != nil {
// query param deadline
var qrDeadline int64
if o.Deadline != nil {
qrDeadline = *o.Deadline
}
qDeadline := swag.FormatInt64(qrDeadline)
if qDeadline != "" {
if err := r.SetQueryParam("deadline", qDeadline); err != nil {
return err
}
}
}
if o.Follow != nil {
// query param follow
var qrFollow bool
if o.Follow != nil {
qrFollow = *o.Follow
}
qFollow := swag.FormatBool(qrFollow)
if qFollow != "" {
if err := r.SetQueryParam("follow", qFollow); err != nil {
return err
}
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if o.Since != nil {
// query param since
var qrSince int64
if o.Since != nil {
qrSince = *o.Since
}
qSince := swag.FormatInt64(qrSince)
if qSince != "" {
if err := r.SetQueryParam("since", qSince); err != nil {
return err
}
}
}
if o.Taillines != nil {
// query param taillines
var qrTaillines int64
if o.Taillines != nil {
qrTaillines = *o.Taillines
}
qTaillines := swag.FormatInt64(qrTaillines)
if qTaillines != "" {
if err := r.SetQueryParam("taillines", qTaillines); err != nil {
return err
}
}
}
if o.Timestamp != nil {
// query param timestamp
var qrTimestamp bool
if o.Timestamp != nil {
qrTimestamp = *o.Timestamp
}
qTimestamp := swag.FormatBool(qrTimestamp)
if qTimestamp != "" {
if err := r.SetQueryParam("timestamp", qTimestamp); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,120 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// GetContainerLogsReader is a Reader for the GetContainerLogs structure.
type GetContainerLogsReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *GetContainerLogsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContainerLogsOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetContainerLogsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetContainerLogsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetContainerLogsOK creates a GetContainerLogsOK with default headers values
func NewGetContainerLogsOK(writer io.Writer) *GetContainerLogsOK {
return &GetContainerLogsOK{
Payload: writer,
}
}
/*GetContainerLogsOK handles this case with default header values.
OK
*/
type GetContainerLogsOK struct {
Payload io.Writer
}
func (o *GetContainerLogsOK) Error() string {
return fmt.Sprintf("[GET /containers/{id}/logs][%d] getContainerLogsOK %+v", 200, o.Payload)
}
func (o *GetContainerLogsOK) 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
}
// NewGetContainerLogsNotFound creates a GetContainerLogsNotFound with default headers values
func NewGetContainerLogsNotFound() *GetContainerLogsNotFound {
return &GetContainerLogsNotFound{}
}
/*GetContainerLogsNotFound handles this case with default header values.
Logs not found
*/
type GetContainerLogsNotFound struct {
}
func (o *GetContainerLogsNotFound) Error() string {
return fmt.Sprintf("[GET /containers/{id}/logs][%d] getContainerLogsNotFound ", 404)
}
func (o *GetContainerLogsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetContainerLogsInternalServerError creates a GetContainerLogsInternalServerError with default headers values
func NewGetContainerLogsInternalServerError() *GetContainerLogsInternalServerError {
return &GetContainerLogsInternalServerError{}
}
/*GetContainerLogsInternalServerError handles this case with default header values.
Failed to get logs
*/
type GetContainerLogsInternalServerError struct {
}
func (o *GetContainerLogsInternalServerError) Error() string {
return fmt.Sprintf("[GET /containers/{id}/logs][%d] getContainerLogsInternalServerError ", 500)
}
func (o *GetContainerLogsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,153 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetContainerStatsParams creates a new GetContainerStatsParams object
// with the default values initialized.
func NewGetContainerStatsParams() *GetContainerStatsParams {
var ()
return &GetContainerStatsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetContainerStatsParamsWithTimeout creates a new GetContainerStatsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetContainerStatsParamsWithTimeout(timeout time.Duration) *GetContainerStatsParams {
var ()
return &GetContainerStatsParams{
timeout: timeout,
}
}
// NewGetContainerStatsParamsWithContext creates a new GetContainerStatsParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetContainerStatsParamsWithContext(ctx context.Context) *GetContainerStatsParams {
var ()
return &GetContainerStatsParams{
Context: ctx,
}
}
// NewGetContainerStatsParamsWithHTTPClient creates a new GetContainerStatsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetContainerStatsParamsWithHTTPClient(client *http.Client) *GetContainerStatsParams {
var ()
return &GetContainerStatsParams{
HTTPClient: client,
}
}
/*GetContainerStatsParams contains all the parameters to send to the API endpoint
for the get container stats operation typically these are written to a http.Request
*/
type GetContainerStatsParams struct {
/*ID*/
ID string
/*Stream*/
Stream bool
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get container stats params
func (o *GetContainerStatsParams) WithTimeout(timeout time.Duration) *GetContainerStatsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get container stats params
func (o *GetContainerStatsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get container stats params
func (o *GetContainerStatsParams) WithContext(ctx context.Context) *GetContainerStatsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get container stats params
func (o *GetContainerStatsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get container stats params
func (o *GetContainerStatsParams) WithHTTPClient(client *http.Client) *GetContainerStatsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get container stats params
func (o *GetContainerStatsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get container stats params
func (o *GetContainerStatsParams) WithID(id string) *GetContainerStatsParams {
o.SetID(id)
return o
}
// SetID adds the id to the get container stats params
func (o *GetContainerStatsParams) SetID(id string) {
o.ID = id
}
// WithStream adds the stream to the get container stats params
func (o *GetContainerStatsParams) WithStream(stream bool) *GetContainerStatsParams {
o.SetStream(stream)
return o
}
// SetStream adds the stream to the get container stats params
func (o *GetContainerStatsParams) SetStream(stream bool) {
o.Stream = stream
}
// WriteToRequest writes these params to a swagger request
func (o *GetContainerStatsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// query param stream
qrStream := o.Stream
qStream := swag.FormatBool(qrStream)
if qStream != "" {
if err := r.SetQueryParam("stream", qStream); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,120 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// GetContainerStatsReader is a Reader for the GetContainerStats structure.
type GetContainerStatsReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *GetContainerStatsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContainerStatsOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetContainerStatsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetContainerStatsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetContainerStatsOK creates a GetContainerStatsOK with default headers values
func NewGetContainerStatsOK(writer io.Writer) *GetContainerStatsOK {
return &GetContainerStatsOK{
Payload: writer,
}
}
/*GetContainerStatsOK handles this case with default header values.
OK
*/
type GetContainerStatsOK struct {
Payload io.Writer
}
func (o *GetContainerStatsOK) Error() string {
return fmt.Sprintf("[GET /containers/{id}/stats][%d] getContainerStatsOK %+v", 200, o.Payload)
}
func (o *GetContainerStatsOK) 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
}
// NewGetContainerStatsNotFound creates a GetContainerStatsNotFound with default headers values
func NewGetContainerStatsNotFound() *GetContainerStatsNotFound {
return &GetContainerStatsNotFound{}
}
/*GetContainerStatsNotFound handles this case with default header values.
Stats not found
*/
type GetContainerStatsNotFound struct {
}
func (o *GetContainerStatsNotFound) Error() string {
return fmt.Sprintf("[GET /containers/{id}/stats][%d] getContainerStatsNotFound ", 404)
}
func (o *GetContainerStatsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetContainerStatsInternalServerError creates a GetContainerStatsInternalServerError with default headers values
func NewGetContainerStatsInternalServerError() *GetContainerStatsInternalServerError {
return &GetContainerStatsInternalServerError{}
}
/*GetContainerStatsInternalServerError handles this case with default header values.
Failed to get stats
*/
type GetContainerStatsInternalServerError struct {
}
func (o *GetContainerStatsInternalServerError) Error() string {
return fmt.Sprintf("[GET /containers/{id}/stats][%d] getContainerStatsInternalServerError ", 500)
}
func (o *GetContainerStatsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,130 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetParams creates a new GetParams object
// with the default values initialized.
func NewGetParams() *GetParams {
var ()
return &GetParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetParamsWithTimeout creates a new GetParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetParamsWithTimeout(timeout time.Duration) *GetParams {
var ()
return &GetParams{
timeout: timeout,
}
}
// NewGetParamsWithContext creates a new GetParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetParamsWithContext(ctx context.Context) *GetParams {
var ()
return &GetParams{
Context: ctx,
}
}
// NewGetParamsWithHTTPClient creates a new GetParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetParamsWithHTTPClient(client *http.Client) *GetParams {
var ()
return &GetParams{
HTTPClient: client,
}
}
/*GetParams contains all the parameters to send to the API endpoint
for the get operation typically these are written to a http.Request
*/
type GetParams struct {
/*ID*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get params
func (o *GetParams) WithTimeout(timeout time.Duration) *GetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get params
func (o *GetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get params
func (o *GetParams) WithContext(ctx context.Context) *GetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get params
func (o *GetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get params
func (o *GetParams) WithHTTPClient(client *http.Client) *GetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get params
func (o *GetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get params
func (o *GetParams) WithID(id string) *GetParams {
o.SetID(id)
return o
}
// SetID adds the id to the get params
func (o *GetParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,144 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetReader is a Reader for the Get structure.
type GetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetDefault(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
}
}
// NewGetOK creates a GetOK with default headers values
func NewGetOK() *GetOK {
return &GetOK{}
}
/*GetOK handles this case with default header values.
OK
*/
type GetOK struct {
Payload string
}
func (o *GetOK) Error() string {
return fmt.Sprintf("[GET /containers/{id}][%d] getOK %+v", 200, o.Payload)
}
func (o *GetOK) 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
}
// NewGetNotFound creates a GetNotFound with default headers values
func NewGetNotFound() *GetNotFound {
return &GetNotFound{}
}
/*GetNotFound handles this case with default header values.
not found
*/
type GetNotFound struct {
Payload *models.Error
}
func (o *GetNotFound) Error() string {
return fmt.Sprintf("[GET /containers/{id}][%d] getNotFound %+v", 404, o.Payload)
}
func (o *GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetDefault creates a GetDefault with default headers values
func NewGetDefault(code int) *GetDefault {
return &GetDefault{
_statusCode: code,
}
}
/*GetDefault handles this case with default header values.
Error
*/
type GetDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get default response
func (o *GetDefault) Code() int {
return o._statusCode
}
func (o *GetDefault) Error() string {
return fmt.Sprintf("[GET /containers/{id}][%d] Get default %+v", o._statusCode, o.Payload)
}
func (o *GetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetStateParams creates a new GetStateParams object
// with the default values initialized.
func NewGetStateParams() *GetStateParams {
var ()
return &GetStateParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetStateParamsWithTimeout creates a new GetStateParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetStateParamsWithTimeout(timeout time.Duration) *GetStateParams {
var ()
return &GetStateParams{
timeout: timeout,
}
}
// NewGetStateParamsWithContext creates a new GetStateParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetStateParamsWithContext(ctx context.Context) *GetStateParams {
var ()
return &GetStateParams{
Context: ctx,
}
}
// NewGetStateParamsWithHTTPClient creates a new GetStateParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetStateParamsWithHTTPClient(client *http.Client) *GetStateParams {
var ()
return &GetStateParams{
HTTPClient: client,
}
}
/*GetStateParams contains all the parameters to send to the API endpoint
for the get state operation typically these are written to a http.Request
*/
type GetStateParams struct {
/*Handle*/
Handle string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get state params
func (o *GetStateParams) WithTimeout(timeout time.Duration) *GetStateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get state params
func (o *GetStateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get state params
func (o *GetStateParams) WithContext(ctx context.Context) *GetStateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get state params
func (o *GetStateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get state params
func (o *GetStateParams) WithHTTPClient(client *http.Client) *GetStateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get state params
func (o *GetStateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the get state params
func (o *GetStateParams) WithHandle(handle string) *GetStateParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the get state params
func (o *GetStateParams) SetHandle(handle string) {
o.Handle = handle
}
// WriteToRequest writes these params to a swagger request
func (o *GetStateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,146 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetStateReader is a Reader for the GetState structure.
type GetStateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetStateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetStateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetStateNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetStateDefault(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
}
}
// NewGetStateOK creates a GetStateOK with default headers values
func NewGetStateOK() *GetStateOK {
return &GetStateOK{}
}
/*GetStateOK handles this case with default header values.
OK
*/
type GetStateOK struct {
Payload *models.ContainerGetStateResponse
}
func (o *GetStateOK) Error() string {
return fmt.Sprintf("[GET /containers/{handle}/state][%d] getStateOK %+v", 200, o.Payload)
}
func (o *GetStateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ContainerGetStateResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetStateNotFound creates a GetStateNotFound with default headers values
func NewGetStateNotFound() *GetStateNotFound {
return &GetStateNotFound{}
}
/*GetStateNotFound handles this case with default header values.
not found
*/
type GetStateNotFound struct {
Payload *models.Error
}
func (o *GetStateNotFound) Error() string {
return fmt.Sprintf("[GET /containers/{handle}/state][%d] getStateNotFound %+v", 404, o.Payload)
}
func (o *GetStateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetStateDefault creates a GetStateDefault with default headers values
func NewGetStateDefault(code int) *GetStateDefault {
return &GetStateDefault{
_statusCode: code,
}
}
/*GetStateDefault handles this case with default header values.
Error
*/
type GetStateDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get state default response
func (o *GetStateDefault) Code() int {
return o._statusCode
}
func (o *GetStateDefault) Error() string {
return fmt.Sprintf("[GET /containers/{handle}/state][%d] GetState default %+v", o._statusCode, o.Payload)
}
func (o *GetStateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,147 @@
package containers
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewStateChangeParams creates a new StateChangeParams object
// with the default values initialized.
func NewStateChangeParams() *StateChangeParams {
var ()
return &StateChangeParams{
timeout: cr.DefaultTimeout,
}
}
// NewStateChangeParamsWithTimeout creates a new StateChangeParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewStateChangeParamsWithTimeout(timeout time.Duration) *StateChangeParams {
var ()
return &StateChangeParams{
timeout: timeout,
}
}
// NewStateChangeParamsWithContext creates a new StateChangeParams object
// with the default values initialized, and the ability to set a context for a request
func NewStateChangeParamsWithContext(ctx context.Context) *StateChangeParams {
var ()
return &StateChangeParams{
Context: ctx,
}
}
// NewStateChangeParamsWithHTTPClient creates a new StateChangeParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewStateChangeParamsWithHTTPClient(client *http.Client) *StateChangeParams {
var ()
return &StateChangeParams{
HTTPClient: client,
}
}
/*StateChangeParams contains all the parameters to send to the API endpoint
for the state change operation typically these are written to a http.Request
*/
type StateChangeParams struct {
/*Handle*/
Handle string
/*State*/
State string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the state change params
func (o *StateChangeParams) WithTimeout(timeout time.Duration) *StateChangeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the state change params
func (o *StateChangeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the state change params
func (o *StateChangeParams) WithContext(ctx context.Context) *StateChangeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the state change params
func (o *StateChangeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the state change params
func (o *StateChangeParams) WithHTTPClient(client *http.Client) *StateChangeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the state change params
func (o *StateChangeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the state change params
func (o *StateChangeParams) WithHandle(handle string) *StateChangeParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the state change params
func (o *StateChangeParams) SetHandle(handle string) {
o.Handle = handle
}
// WithState adds the state to the state change params
func (o *StateChangeParams) WithState(state string) *StateChangeParams {
o.SetState(state)
return o
}
// SetState adds the state to the state change params
func (o *StateChangeParams) SetState(state string) {
o.State = state
}
// WriteToRequest writes these params to a swagger request
func (o *StateChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
if err := r.SetBodyParam(o.State); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,144 @@
package containers
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// StateChangeReader is a Reader for the StateChange structure.
type StateChangeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *StateChangeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewStateChangeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewStateChangeNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewStateChangeDefault(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
}
}
// NewStateChangeOK creates a StateChangeOK with default headers values
func NewStateChangeOK() *StateChangeOK {
return &StateChangeOK{}
}
/*StateChangeOK handles this case with default header values.
OK
*/
type StateChangeOK struct {
Payload string
}
func (o *StateChangeOK) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}/state][%d] stateChangeOK %+v", 200, o.Payload)
}
func (o *StateChangeOK) 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
}
// NewStateChangeNotFound creates a StateChangeNotFound with default headers values
func NewStateChangeNotFound() *StateChangeNotFound {
return &StateChangeNotFound{}
}
/*StateChangeNotFound handles this case with default header values.
not found
*/
type StateChangeNotFound struct {
Payload *models.Error
}
func (o *StateChangeNotFound) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}/state][%d] stateChangeNotFound %+v", 404, o.Payload)
}
func (o *StateChangeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewStateChangeDefault creates a StateChangeDefault with default headers values
func NewStateChangeDefault(code int) *StateChangeDefault {
return &StateChangeDefault{
_statusCode: code,
}
}
/*StateChangeDefault handles this case with default header values.
Error
*/
type StateChangeDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the state change default response
func (o *StateChangeDefault) Code() int {
return o._statusCode
}
func (o *StateChangeDefault) Error() string {
return fmt.Sprintf("[PUT /containers/{handle}/state][%d] StateChange default %+v", o._statusCode, o.Payload)
}
func (o *StateChangeDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,60 @@
package events
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new events API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for events API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
GetEvents gets portlayer events
Gets portlayer events
*/
func (a *Client) GetEvents(params *GetEventsParams, writer io.Writer) (*GetEventsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetEventsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetEvents",
Method: "GET",
PathPattern: "/events",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetEventsReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetEventsOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,110 @@
package events
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetEventsParams creates a new GetEventsParams object
// with the default values initialized.
func NewGetEventsParams() *GetEventsParams {
return &GetEventsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetEventsParamsWithTimeout creates a new GetEventsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetEventsParamsWithTimeout(timeout time.Duration) *GetEventsParams {
return &GetEventsParams{
timeout: timeout,
}
}
// NewGetEventsParamsWithContext creates a new GetEventsParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetEventsParamsWithContext(ctx context.Context) *GetEventsParams {
return &GetEventsParams{
Context: ctx,
}
}
// NewGetEventsParamsWithHTTPClient creates a new GetEventsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetEventsParamsWithHTTPClient(client *http.Client) *GetEventsParams {
return &GetEventsParams{
HTTPClient: client,
}
}
/*GetEventsParams contains all the parameters to send to the API endpoint
for the get events operation typically these are written to a http.Request
*/
type GetEventsParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get events params
func (o *GetEventsParams) WithTimeout(timeout time.Duration) *GetEventsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get events params
func (o *GetEventsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get events params
func (o *GetEventsParams) WithContext(ctx context.Context) *GetEventsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get events params
func (o *GetEventsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get events params
func (o *GetEventsParams) WithHTTPClient(client *http.Client) *GetEventsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get events params
func (o *GetEventsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,92 @@
package events
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// GetEventsReader is a Reader for the GetEvents structure.
type GetEventsReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *GetEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetEventsOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewGetEventsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetEventsOK creates a GetEventsOK with default headers values
func NewGetEventsOK(writer io.Writer) *GetEventsOK {
return &GetEventsOK{
Payload: writer,
}
}
/*GetEventsOK handles this case with default header values.
OK
*/
type GetEventsOK struct {
Payload io.Writer
}
func (o *GetEventsOK) Error() string {
return fmt.Sprintf("[GET /events][%d] getEventsOK %+v", 200, o.Payload)
}
func (o *GetEventsOK) 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
}
// NewGetEventsInternalServerError creates a GetEventsInternalServerError with default headers values
func NewGetEventsInternalServerError() *GetEventsInternalServerError {
return &GetEventsInternalServerError{}
}
/*GetEventsInternalServerError handles this case with default header values.
Failed to get events
*/
type GetEventsInternalServerError struct {
}
func (o *GetEventsInternalServerError) Error() string {
return fmt.Sprintf("[GET /events][%d] getEventsInternalServerError ", 500)
}
func (o *GetEventsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,130 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerCloseStdinParams creates a new ContainerCloseStdinParams object
// with the default values initialized.
func NewContainerCloseStdinParams() *ContainerCloseStdinParams {
var ()
return &ContainerCloseStdinParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerCloseStdinParamsWithTimeout creates a new ContainerCloseStdinParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerCloseStdinParamsWithTimeout(timeout time.Duration) *ContainerCloseStdinParams {
var ()
return &ContainerCloseStdinParams{
timeout: timeout,
}
}
// NewContainerCloseStdinParamsWithContext creates a new ContainerCloseStdinParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerCloseStdinParamsWithContext(ctx context.Context) *ContainerCloseStdinParams {
var ()
return &ContainerCloseStdinParams{
Context: ctx,
}
}
// NewContainerCloseStdinParamsWithHTTPClient creates a new ContainerCloseStdinParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerCloseStdinParamsWithHTTPClient(client *http.Client) *ContainerCloseStdinParams {
var ()
return &ContainerCloseStdinParams{
HTTPClient: client,
}
}
/*ContainerCloseStdinParams contains all the parameters to send to the API endpoint
for the container close stdin operation typically these are written to a http.Request
*/
type ContainerCloseStdinParams struct {
/*ID*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container close stdin params
func (o *ContainerCloseStdinParams) WithTimeout(timeout time.Duration) *ContainerCloseStdinParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container close stdin params
func (o *ContainerCloseStdinParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container close stdin params
func (o *ContainerCloseStdinParams) WithContext(ctx context.Context) *ContainerCloseStdinParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container close stdin params
func (o *ContainerCloseStdinParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container close stdin params
func (o *ContainerCloseStdinParams) WithHTTPClient(client *http.Client) *ContainerCloseStdinParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container close stdin params
func (o *ContainerCloseStdinParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the container close stdin params
func (o *ContainerCloseStdinParams) WithID(id string) *ContainerCloseStdinParams {
o.SetID(id)
return o
}
// SetID adds the id to the container close stdin params
func (o *ContainerCloseStdinParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerCloseStdinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,129 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerCloseStdinReader is a Reader for the ContainerCloseStdin structure.
type ContainerCloseStdinReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerCloseStdinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerCloseStdinOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerCloseStdinNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerCloseStdinInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerCloseStdinOK creates a ContainerCloseStdinOK with default headers values
func NewContainerCloseStdinOK() *ContainerCloseStdinOK {
return &ContainerCloseStdinOK{}
}
/*ContainerCloseStdinOK handles this case with default header values.
OK
*/
type ContainerCloseStdinOK struct {
}
func (o *ContainerCloseStdinOK) Error() string {
return fmt.Sprintf("[DELETE /interaction/{id}/stdin][%d] containerCloseStdinOK ", 200)
}
func (o *ContainerCloseStdinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerCloseStdinNotFound creates a ContainerCloseStdinNotFound with default headers values
func NewContainerCloseStdinNotFound() *ContainerCloseStdinNotFound {
return &ContainerCloseStdinNotFound{}
}
/*ContainerCloseStdinNotFound handles this case with default header values.
Container not found
*/
type ContainerCloseStdinNotFound struct {
Payload *models.Error
}
func (o *ContainerCloseStdinNotFound) Error() string {
return fmt.Sprintf("[DELETE /interaction/{id}/stdin][%d] containerCloseStdinNotFound %+v", 404, o.Payload)
}
func (o *ContainerCloseStdinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerCloseStdinInternalServerError creates a ContainerCloseStdinInternalServerError with default headers values
func NewContainerCloseStdinInternalServerError() *ContainerCloseStdinInternalServerError {
return &ContainerCloseStdinInternalServerError{}
}
/*ContainerCloseStdinInternalServerError handles this case with default header values.
Failed to Close stdin
*/
type ContainerCloseStdinInternalServerError struct {
Payload *models.Error
}
func (o *ContainerCloseStdinInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /interaction/{id}/stdin][%d] containerCloseStdinInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerCloseStdinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,159 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerGetStderrParams creates a new ContainerGetStderrParams object
// with the default values initialized.
func NewContainerGetStderrParams() *ContainerGetStderrParams {
var ()
return &ContainerGetStderrParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerGetStderrParamsWithTimeout creates a new ContainerGetStderrParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerGetStderrParamsWithTimeout(timeout time.Duration) *ContainerGetStderrParams {
var ()
return &ContainerGetStderrParams{
timeout: timeout,
}
}
// NewContainerGetStderrParamsWithContext creates a new ContainerGetStderrParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerGetStderrParamsWithContext(ctx context.Context) *ContainerGetStderrParams {
var ()
return &ContainerGetStderrParams{
Context: ctx,
}
}
// NewContainerGetStderrParamsWithHTTPClient creates a new ContainerGetStderrParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerGetStderrParamsWithHTTPClient(client *http.Client) *ContainerGetStderrParams {
var ()
return &ContainerGetStderrParams{
HTTPClient: client,
}
}
/*ContainerGetStderrParams contains all the parameters to send to the API endpoint
for the container get stderr operation typically these are written to a http.Request
*/
type ContainerGetStderrParams struct {
/*Deadline*/
Deadline *strfmt.DateTime
/*ID*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container get stderr params
func (o *ContainerGetStderrParams) WithTimeout(timeout time.Duration) *ContainerGetStderrParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container get stderr params
func (o *ContainerGetStderrParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container get stderr params
func (o *ContainerGetStderrParams) WithContext(ctx context.Context) *ContainerGetStderrParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container get stderr params
func (o *ContainerGetStderrParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container get stderr params
func (o *ContainerGetStderrParams) WithHTTPClient(client *http.Client) *ContainerGetStderrParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container get stderr params
func (o *ContainerGetStderrParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithDeadline adds the deadline to the container get stderr params
func (o *ContainerGetStderrParams) WithDeadline(deadline *strfmt.DateTime) *ContainerGetStderrParams {
o.SetDeadline(deadline)
return o
}
// SetDeadline adds the deadline to the container get stderr params
func (o *ContainerGetStderrParams) SetDeadline(deadline *strfmt.DateTime) {
o.Deadline = deadline
}
// WithID adds the id to the container get stderr params
func (o *ContainerGetStderrParams) WithID(id string) *ContainerGetStderrParams {
o.SetID(id)
return o
}
// SetID adds the id to the container get stderr params
func (o *ContainerGetStderrParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerGetStderrParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Deadline != nil {
// query param deadline
var qrDeadline strfmt.DateTime
if o.Deadline != nil {
qrDeadline = *o.Deadline
}
qDeadline := qrDeadline.String()
if qDeadline != "" {
if err := r.SetQueryParam("deadline", qDeadline); err != nil {
return err
}
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,120 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// ContainerGetStderrReader is a Reader for the ContainerGetStderr structure.
type ContainerGetStderrReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *ContainerGetStderrReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerGetStderrOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerGetStderrNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerGetStderrInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerGetStderrOK creates a ContainerGetStderrOK with default headers values
func NewContainerGetStderrOK(writer io.Writer) *ContainerGetStderrOK {
return &ContainerGetStderrOK{
Payload: writer,
}
}
/*ContainerGetStderrOK handles this case with default header values.
OK
*/
type ContainerGetStderrOK struct {
Payload io.Writer
}
func (o *ContainerGetStderrOK) Error() string {
return fmt.Sprintf("[GET /interaction/{id}/stderr][%d] containerGetStderrOK %+v", 200, o.Payload)
}
func (o *ContainerGetStderrOK) 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
}
// NewContainerGetStderrNotFound creates a ContainerGetStderrNotFound with default headers values
func NewContainerGetStderrNotFound() *ContainerGetStderrNotFound {
return &ContainerGetStderrNotFound{}
}
/*ContainerGetStderrNotFound handles this case with default header values.
Container not found
*/
type ContainerGetStderrNotFound struct {
}
func (o *ContainerGetStderrNotFound) Error() string {
return fmt.Sprintf("[GET /interaction/{id}/stderr][%d] containerGetStderrNotFound ", 404)
}
func (o *ContainerGetStderrNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerGetStderrInternalServerError creates a ContainerGetStderrInternalServerError with default headers values
func NewContainerGetStderrInternalServerError() *ContainerGetStderrInternalServerError {
return &ContainerGetStderrInternalServerError{}
}
/*ContainerGetStderrInternalServerError handles this case with default header values.
Failed to get stderr
*/
type ContainerGetStderrInternalServerError struct {
}
func (o *ContainerGetStderrInternalServerError) Error() string {
return fmt.Sprintf("[GET /interaction/{id}/stderr][%d] containerGetStderrInternalServerError ", 500)
}
func (o *ContainerGetStderrInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,159 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerGetStdoutParams creates a new ContainerGetStdoutParams object
// with the default values initialized.
func NewContainerGetStdoutParams() *ContainerGetStdoutParams {
var ()
return &ContainerGetStdoutParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerGetStdoutParamsWithTimeout creates a new ContainerGetStdoutParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerGetStdoutParamsWithTimeout(timeout time.Duration) *ContainerGetStdoutParams {
var ()
return &ContainerGetStdoutParams{
timeout: timeout,
}
}
// NewContainerGetStdoutParamsWithContext creates a new ContainerGetStdoutParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerGetStdoutParamsWithContext(ctx context.Context) *ContainerGetStdoutParams {
var ()
return &ContainerGetStdoutParams{
Context: ctx,
}
}
// NewContainerGetStdoutParamsWithHTTPClient creates a new ContainerGetStdoutParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerGetStdoutParamsWithHTTPClient(client *http.Client) *ContainerGetStdoutParams {
var ()
return &ContainerGetStdoutParams{
HTTPClient: client,
}
}
/*ContainerGetStdoutParams contains all the parameters to send to the API endpoint
for the container get stdout operation typically these are written to a http.Request
*/
type ContainerGetStdoutParams struct {
/*Deadline*/
Deadline *strfmt.DateTime
/*ID*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container get stdout params
func (o *ContainerGetStdoutParams) WithTimeout(timeout time.Duration) *ContainerGetStdoutParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container get stdout params
func (o *ContainerGetStdoutParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container get stdout params
func (o *ContainerGetStdoutParams) WithContext(ctx context.Context) *ContainerGetStdoutParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container get stdout params
func (o *ContainerGetStdoutParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container get stdout params
func (o *ContainerGetStdoutParams) WithHTTPClient(client *http.Client) *ContainerGetStdoutParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container get stdout params
func (o *ContainerGetStdoutParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithDeadline adds the deadline to the container get stdout params
func (o *ContainerGetStdoutParams) WithDeadline(deadline *strfmt.DateTime) *ContainerGetStdoutParams {
o.SetDeadline(deadline)
return o
}
// SetDeadline adds the deadline to the container get stdout params
func (o *ContainerGetStdoutParams) SetDeadline(deadline *strfmt.DateTime) {
o.Deadline = deadline
}
// WithID adds the id to the container get stdout params
func (o *ContainerGetStdoutParams) WithID(id string) *ContainerGetStdoutParams {
o.SetID(id)
return o
}
// SetID adds the id to the container get stdout params
func (o *ContainerGetStdoutParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerGetStdoutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Deadline != nil {
// query param deadline
var qrDeadline strfmt.DateTime
if o.Deadline != nil {
qrDeadline = *o.Deadline
}
qDeadline := qrDeadline.String()
if qDeadline != "" {
if err := r.SetQueryParam("deadline", qDeadline); err != nil {
return err
}
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,120 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// ContainerGetStdoutReader is a Reader for the ContainerGetStdout structure.
type ContainerGetStdoutReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *ContainerGetStdoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerGetStdoutOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerGetStdoutNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerGetStdoutInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerGetStdoutOK creates a ContainerGetStdoutOK with default headers values
func NewContainerGetStdoutOK(writer io.Writer) *ContainerGetStdoutOK {
return &ContainerGetStdoutOK{
Payload: writer,
}
}
/*ContainerGetStdoutOK handles this case with default header values.
OK
*/
type ContainerGetStdoutOK struct {
Payload io.Writer
}
func (o *ContainerGetStdoutOK) Error() string {
return fmt.Sprintf("[GET /interaction/{id}/stdout][%d] containerGetStdoutOK %+v", 200, o.Payload)
}
func (o *ContainerGetStdoutOK) 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
}
// NewContainerGetStdoutNotFound creates a ContainerGetStdoutNotFound with default headers values
func NewContainerGetStdoutNotFound() *ContainerGetStdoutNotFound {
return &ContainerGetStdoutNotFound{}
}
/*ContainerGetStdoutNotFound handles this case with default header values.
Container not found
*/
type ContainerGetStdoutNotFound struct {
}
func (o *ContainerGetStdoutNotFound) Error() string {
return fmt.Sprintf("[GET /interaction/{id}/stdout][%d] containerGetStdoutNotFound ", 404)
}
func (o *ContainerGetStdoutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerGetStdoutInternalServerError creates a ContainerGetStdoutInternalServerError with default headers values
func NewContainerGetStdoutInternalServerError() *ContainerGetStdoutInternalServerError {
return &ContainerGetStdoutInternalServerError{}
}
/*ContainerGetStdoutInternalServerError handles this case with default header values.
Failed to get stdout
*/
type ContainerGetStdoutInternalServerError struct {
}
func (o *ContainerGetStdoutInternalServerError) Error() string {
return fmt.Sprintf("[GET /interaction/{id}/stdout][%d] containerGetStdoutInternalServerError ", 500)
}
func (o *ContainerGetStdoutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,175 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerResizeParams creates a new ContainerResizeParams object
// with the default values initialized.
func NewContainerResizeParams() *ContainerResizeParams {
var ()
return &ContainerResizeParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerResizeParamsWithTimeout creates a new ContainerResizeParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerResizeParamsWithTimeout(timeout time.Duration) *ContainerResizeParams {
var ()
return &ContainerResizeParams{
timeout: timeout,
}
}
// NewContainerResizeParamsWithContext creates a new ContainerResizeParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerResizeParamsWithContext(ctx context.Context) *ContainerResizeParams {
var ()
return &ContainerResizeParams{
Context: ctx,
}
}
// NewContainerResizeParamsWithHTTPClient creates a new ContainerResizeParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerResizeParamsWithHTTPClient(client *http.Client) *ContainerResizeParams {
var ()
return &ContainerResizeParams{
HTTPClient: client,
}
}
/*ContainerResizeParams contains all the parameters to send to the API endpoint
for the container resize operation typically these are written to a http.Request
*/
type ContainerResizeParams struct {
/*Height*/
Height int32
/*ID*/
ID string
/*Width*/
Width int32
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container resize params
func (o *ContainerResizeParams) WithTimeout(timeout time.Duration) *ContainerResizeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container resize params
func (o *ContainerResizeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container resize params
func (o *ContainerResizeParams) WithContext(ctx context.Context) *ContainerResizeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container resize params
func (o *ContainerResizeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container resize params
func (o *ContainerResizeParams) WithHTTPClient(client *http.Client) *ContainerResizeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container resize params
func (o *ContainerResizeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHeight adds the height to the container resize params
func (o *ContainerResizeParams) WithHeight(height int32) *ContainerResizeParams {
o.SetHeight(height)
return o
}
// SetHeight adds the height to the container resize params
func (o *ContainerResizeParams) SetHeight(height int32) {
o.Height = height
}
// WithID adds the id to the container resize params
func (o *ContainerResizeParams) WithID(id string) *ContainerResizeParams {
o.SetID(id)
return o
}
// SetID adds the id to the container resize params
func (o *ContainerResizeParams) SetID(id string) {
o.ID = id
}
// WithWidth adds the width to the container resize params
func (o *ContainerResizeParams) WithWidth(width int32) *ContainerResizeParams {
o.SetWidth(width)
return o
}
// SetWidth adds the width to the container resize params
func (o *ContainerResizeParams) SetWidth(width int32) {
o.Width = width
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerResizeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// query param height
qrHeight := o.Height
qHeight := swag.FormatInt32(qrHeight)
if qHeight != "" {
if err := r.SetQueryParam("height", qHeight); err != nil {
return err
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// query param width
qrWidth := o.Width
qWidth := swag.FormatInt32(qrWidth)
if qWidth != "" {
if err := r.SetQueryParam("width", qWidth); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,129 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerResizeReader is a Reader for the ContainerResize structure.
type ContainerResizeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerResizeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerResizeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerResizeNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerResizeInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerResizeOK creates a ContainerResizeOK with default headers values
func NewContainerResizeOK() *ContainerResizeOK {
return &ContainerResizeOK{}
}
/*ContainerResizeOK handles this case with default header values.
OK
*/
type ContainerResizeOK struct {
}
func (o *ContainerResizeOK) Error() string {
return fmt.Sprintf("[POST /interaction/{id}/resize][%d] containerResizeOK ", 200)
}
func (o *ContainerResizeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerResizeNotFound creates a ContainerResizeNotFound with default headers values
func NewContainerResizeNotFound() *ContainerResizeNotFound {
return &ContainerResizeNotFound{}
}
/*ContainerResizeNotFound handles this case with default header values.
Container not found
*/
type ContainerResizeNotFound struct {
Payload *models.Error
}
func (o *ContainerResizeNotFound) Error() string {
return fmt.Sprintf("[POST /interaction/{id}/resize][%d] containerResizeNotFound %+v", 404, o.Payload)
}
func (o *ContainerResizeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerResizeInternalServerError creates a ContainerResizeInternalServerError with default headers values
func NewContainerResizeInternalServerError() *ContainerResizeInternalServerError {
return &ContainerResizeInternalServerError{}
}
/*ContainerResizeInternalServerError handles this case with default header values.
Container resize failed
*/
type ContainerResizeInternalServerError struct {
Payload *models.Error
}
func (o *ContainerResizeInternalServerError) Error() string {
return fmt.Sprintf("[POST /interaction/{id}/resize][%d] containerResizeInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerResizeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,177 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewContainerSetStdinParams creates a new ContainerSetStdinParams object
// with the default values initialized.
func NewContainerSetStdinParams() *ContainerSetStdinParams {
var ()
return &ContainerSetStdinParams{
timeout: cr.DefaultTimeout,
}
}
// NewContainerSetStdinParamsWithTimeout creates a new ContainerSetStdinParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewContainerSetStdinParamsWithTimeout(timeout time.Duration) *ContainerSetStdinParams {
var ()
return &ContainerSetStdinParams{
timeout: timeout,
}
}
// NewContainerSetStdinParamsWithContext creates a new ContainerSetStdinParams object
// with the default values initialized, and the ability to set a context for a request
func NewContainerSetStdinParamsWithContext(ctx context.Context) *ContainerSetStdinParams {
var ()
return &ContainerSetStdinParams{
Context: ctx,
}
}
// NewContainerSetStdinParamsWithHTTPClient creates a new ContainerSetStdinParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewContainerSetStdinParamsWithHTTPClient(client *http.Client) *ContainerSetStdinParams {
var ()
return &ContainerSetStdinParams{
HTTPClient: client,
}
}
/*ContainerSetStdinParams contains all the parameters to send to the API endpoint
for the container set stdin operation typically these are written to a http.Request
*/
type ContainerSetStdinParams struct {
/*Deadline*/
Deadline *strfmt.DateTime
/*ID*/
ID string
/*RawStream*/
RawStream io.ReadCloser
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the container set stdin params
func (o *ContainerSetStdinParams) WithTimeout(timeout time.Duration) *ContainerSetStdinParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the container set stdin params
func (o *ContainerSetStdinParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the container set stdin params
func (o *ContainerSetStdinParams) WithContext(ctx context.Context) *ContainerSetStdinParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the container set stdin params
func (o *ContainerSetStdinParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the container set stdin params
func (o *ContainerSetStdinParams) WithHTTPClient(client *http.Client) *ContainerSetStdinParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the container set stdin params
func (o *ContainerSetStdinParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithDeadline adds the deadline to the container set stdin params
func (o *ContainerSetStdinParams) WithDeadline(deadline *strfmt.DateTime) *ContainerSetStdinParams {
o.SetDeadline(deadline)
return o
}
// SetDeadline adds the deadline to the container set stdin params
func (o *ContainerSetStdinParams) SetDeadline(deadline *strfmt.DateTime) {
o.Deadline = deadline
}
// WithID adds the id to the container set stdin params
func (o *ContainerSetStdinParams) WithID(id string) *ContainerSetStdinParams {
o.SetID(id)
return o
}
// SetID adds the id to the container set stdin params
func (o *ContainerSetStdinParams) SetID(id string) {
o.ID = id
}
// WithRawStream adds the rawStream to the container set stdin params
func (o *ContainerSetStdinParams) WithRawStream(rawStream io.ReadCloser) *ContainerSetStdinParams {
o.SetRawStream(rawStream)
return o
}
// SetRawStream adds the rawStream to the container set stdin params
func (o *ContainerSetStdinParams) SetRawStream(rawStream io.ReadCloser) {
o.RawStream = rawStream
}
// WriteToRequest writes these params to a swagger request
func (o *ContainerSetStdinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Deadline != nil {
// query param deadline
var qrDeadline strfmt.DateTime
if o.Deadline != nil {
qrDeadline = *o.Deadline
}
qDeadline := qrDeadline.String()
if qDeadline != "" {
if err := r.SetQueryParam("deadline", qDeadline); err != nil {
return err
}
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if err := r.SetBodyParam(o.RawStream); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,129 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ContainerSetStdinReader is a Reader for the ContainerSetStdin structure.
type ContainerSetStdinReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ContainerSetStdinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewContainerSetStdinOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewContainerSetStdinNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewContainerSetStdinInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewContainerSetStdinOK creates a ContainerSetStdinOK with default headers values
func NewContainerSetStdinOK() *ContainerSetStdinOK {
return &ContainerSetStdinOK{}
}
/*ContainerSetStdinOK handles this case with default header values.
OK
*/
type ContainerSetStdinOK struct {
}
func (o *ContainerSetStdinOK) Error() string {
return fmt.Sprintf("[POST /interaction/{id}/stdin][%d] containerSetStdinOK ", 200)
}
func (o *ContainerSetStdinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewContainerSetStdinNotFound creates a ContainerSetStdinNotFound with default headers values
func NewContainerSetStdinNotFound() *ContainerSetStdinNotFound {
return &ContainerSetStdinNotFound{}
}
/*ContainerSetStdinNotFound handles this case with default header values.
Container not found
*/
type ContainerSetStdinNotFound struct {
Payload *models.Error
}
func (o *ContainerSetStdinNotFound) Error() string {
return fmt.Sprintf("[POST /interaction/{id}/stdin][%d] containerSetStdinNotFound %+v", 404, o.Payload)
}
func (o *ContainerSetStdinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewContainerSetStdinInternalServerError creates a ContainerSetStdinInternalServerError with default headers values
func NewContainerSetStdinInternalServerError() *ContainerSetStdinInternalServerError {
return &ContainerSetStdinInternalServerError{}
}
/*ContainerSetStdinInternalServerError handles this case with default header values.
Failed to Set stdin
*/
type ContainerSetStdinInternalServerError struct {
Payload *models.Error
}
func (o *ContainerSetStdinInternalServerError) Error() string {
return fmt.Sprintf("[POST /interaction/{id}/stdin][%d] containerSetStdinInternalServerError %+v", 500, o.Payload)
}
func (o *ContainerSetStdinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewInteractionBindParams creates a new InteractionBindParams object
// with the default values initialized.
func NewInteractionBindParams() *InteractionBindParams {
var ()
return &InteractionBindParams{
timeout: cr.DefaultTimeout,
}
}
// NewInteractionBindParamsWithTimeout creates a new InteractionBindParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewInteractionBindParamsWithTimeout(timeout time.Duration) *InteractionBindParams {
var ()
return &InteractionBindParams{
timeout: timeout,
}
}
// NewInteractionBindParamsWithContext creates a new InteractionBindParams object
// with the default values initialized, and the ability to set a context for a request
func NewInteractionBindParamsWithContext(ctx context.Context) *InteractionBindParams {
var ()
return &InteractionBindParams{
Context: ctx,
}
}
// NewInteractionBindParamsWithHTTPClient creates a new InteractionBindParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewInteractionBindParamsWithHTTPClient(client *http.Client) *InteractionBindParams {
var ()
return &InteractionBindParams{
HTTPClient: client,
}
}
/*InteractionBindParams contains all the parameters to send to the API endpoint
for the interaction bind operation typically these are written to a http.Request
*/
type InteractionBindParams struct {
/*Config*/
Config *models.InteractionBindConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the interaction bind params
func (o *InteractionBindParams) WithTimeout(timeout time.Duration) *InteractionBindParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the interaction bind params
func (o *InteractionBindParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the interaction bind params
func (o *InteractionBindParams) WithContext(ctx context.Context) *InteractionBindParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the interaction bind params
func (o *InteractionBindParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the interaction bind params
func (o *InteractionBindParams) WithHTTPClient(client *http.Client) *InteractionBindParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the interaction bind params
func (o *InteractionBindParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the interaction bind params
func (o *InteractionBindParams) WithConfig(config *models.InteractionBindConfig) *InteractionBindParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the interaction bind params
func (o *InteractionBindParams) SetConfig(config *models.InteractionBindConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *InteractionBindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.InteractionBindConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// InteractionBindReader is a Reader for the InteractionBind structure.
type InteractionBindReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *InteractionBindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewInteractionBindOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewInteractionBindNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewInteractionBindInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewInteractionBindOK creates a InteractionBindOK with default headers values
func NewInteractionBindOK() *InteractionBindOK {
return &InteractionBindOK{}
}
/*InteractionBindOK handles this case with default header values.
OK
*/
type InteractionBindOK struct {
Payload *models.InteractionBindResponse
}
func (o *InteractionBindOK) Error() string {
return fmt.Sprintf("[POST /interaction/binding][%d] interactionBindOK %+v", 200, o.Payload)
}
func (o *InteractionBindOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.InteractionBindResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewInteractionBindNotFound creates a InteractionBindNotFound with default headers values
func NewInteractionBindNotFound() *InteractionBindNotFound {
return &InteractionBindNotFound{}
}
/*InteractionBindNotFound handles this case with default header values.
VirtualDevice not found
*/
type InteractionBindNotFound struct {
Payload *models.Error
}
func (o *InteractionBindNotFound) Error() string {
return fmt.Sprintf("[POST /interaction/binding][%d] interactionBindNotFound %+v", 404, o.Payload)
}
func (o *InteractionBindNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewInteractionBindInternalServerError creates a InteractionBindInternalServerError with default headers values
func NewInteractionBindInternalServerError() *InteractionBindInternalServerError {
return &InteractionBindInternalServerError{}
}
/*InteractionBindInternalServerError handles this case with default header values.
Connecting VirtualDevice failed
*/
type InteractionBindInternalServerError struct {
Payload *models.Error
}
func (o *InteractionBindInternalServerError) Error() string {
return fmt.Sprintf("[POST /interaction/binding][%d] interactionBindInternalServerError %+v", 500, o.Payload)
}
func (o *InteractionBindInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,270 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new interaction API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for interaction API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
ContainerCloseStdin closes stdin
Close a stdin for the container
*/
func (a *Client) ContainerCloseStdin(params *ContainerCloseStdinParams) (*ContainerCloseStdinOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerCloseStdinParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerCloseStdin",
Method: "DELETE",
PathPattern: "/interaction/{id}/stdin",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerCloseStdinReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerCloseStdinOK), nil
}
/*
ContainerGetStderr gets stderr
Get a stderr for the container
*/
func (a *Client) ContainerGetStderr(params *ContainerGetStderrParams, writer io.Writer) (*ContainerGetStderrOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerGetStderrParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerGetStderr",
Method: "GET",
PathPattern: "/interaction/{id}/stderr",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerGetStderrReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerGetStderrOK), nil
}
/*
ContainerGetStdout gets stdout
Get a stdout for the container
*/
func (a *Client) ContainerGetStdout(params *ContainerGetStdoutParams, writer io.Writer) (*ContainerGetStdoutOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerGetStdoutParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerGetStdout",
Method: "GET",
PathPattern: "/interaction/{id}/stdout",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerGetStdoutReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerGetStdoutOK), nil
}
/*
ContainerResize resizes tty session
Resize the container's tty session
*/
func (a *Client) ContainerResize(params *ContainerResizeParams) (*ContainerResizeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerResizeParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerResize",
Method: "POST",
PathPattern: "/interaction/{id}/resize",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerResizeReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerResizeOK), nil
}
/*
ContainerSetStdin sets stdin
Set a stdin for the container
*/
func (a *Client) ContainerSetStdin(params *ContainerSetStdinParams) (*ContainerSetStdinOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewContainerSetStdinParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ContainerSetStdin",
Method: "POST",
PathPattern: "/interaction/{id}/stdin",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/raw-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &ContainerSetStdinReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ContainerSetStdinOK), nil
}
/*
InteractionBind enables bind activate the virtual device
Enable/bind/activate the VirtualDevice
*/
func (a *Client) InteractionBind(params *InteractionBindParams) (*InteractionBindOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewInteractionBindParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "InteractionBind",
Method: "POST",
PathPattern: "/interaction/binding",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &InteractionBindReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*InteractionBindOK), nil
}
/*
InteractionJoin adds interaction capability
Adds interaction capabilities to given handle
*/
func (a *Client) InteractionJoin(params *InteractionJoinParams) (*InteractionJoinOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewInteractionJoinParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "InteractionJoin",
Method: "POST",
PathPattern: "/interaction",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &InteractionJoinReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*InteractionJoinOK), nil
}
/*
InteractionUnbind disables unbind deactivate the virtual device
Disable/unbind/deactivate the VirtualDevice
*/
func (a *Client) InteractionUnbind(params *InteractionUnbindParams) (*InteractionUnbindOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewInteractionUnbindParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "InteractionUnbind",
Method: "DELETE",
PathPattern: "/interaction/binding",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &InteractionUnbindReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*InteractionUnbindOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,135 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewInteractionJoinParams creates a new InteractionJoinParams object
// with the default values initialized.
func NewInteractionJoinParams() *InteractionJoinParams {
var ()
return &InteractionJoinParams{
timeout: cr.DefaultTimeout,
}
}
// NewInteractionJoinParamsWithTimeout creates a new InteractionJoinParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewInteractionJoinParamsWithTimeout(timeout time.Duration) *InteractionJoinParams {
var ()
return &InteractionJoinParams{
timeout: timeout,
}
}
// NewInteractionJoinParamsWithContext creates a new InteractionJoinParams object
// with the default values initialized, and the ability to set a context for a request
func NewInteractionJoinParamsWithContext(ctx context.Context) *InteractionJoinParams {
var ()
return &InteractionJoinParams{
Context: ctx,
}
}
// NewInteractionJoinParamsWithHTTPClient creates a new InteractionJoinParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewInteractionJoinParamsWithHTTPClient(client *http.Client) *InteractionJoinParams {
var ()
return &InteractionJoinParams{
HTTPClient: client,
}
}
/*InteractionJoinParams contains all the parameters to send to the API endpoint
for the interaction join operation typically these are written to a http.Request
*/
type InteractionJoinParams struct {
/*Config*/
Config *models.InteractionJoinConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the interaction join params
func (o *InteractionJoinParams) WithTimeout(timeout time.Duration) *InteractionJoinParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the interaction join params
func (o *InteractionJoinParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the interaction join params
func (o *InteractionJoinParams) WithContext(ctx context.Context) *InteractionJoinParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the interaction join params
func (o *InteractionJoinParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the interaction join params
func (o *InteractionJoinParams) WithHTTPClient(client *http.Client) *InteractionJoinParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the interaction join params
func (o *InteractionJoinParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the interaction join params
func (o *InteractionJoinParams) WithConfig(config *models.InteractionJoinConfig) *InteractionJoinParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the interaction join params
func (o *InteractionJoinParams) SetConfig(config *models.InteractionJoinConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *InteractionJoinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.InteractionJoinConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// InteractionJoinReader is a Reader for the InteractionJoin structure.
type InteractionJoinReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *InteractionJoinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewInteractionJoinOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewInteractionJoinNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewInteractionJoinInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewInteractionJoinOK creates a InteractionJoinOK with default headers values
func NewInteractionJoinOK() *InteractionJoinOK {
return &InteractionJoinOK{}
}
/*InteractionJoinOK handles this case with default header values.
OK
*/
type InteractionJoinOK struct {
Payload *models.InteractionJoinResponse
}
func (o *InteractionJoinOK) Error() string {
return fmt.Sprintf("[POST /interaction][%d] interactionJoinOK %+v", 200, o.Payload)
}
func (o *InteractionJoinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.InteractionJoinResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewInteractionJoinNotFound creates a InteractionJoinNotFound with default headers values
func NewInteractionJoinNotFound() *InteractionJoinNotFound {
return &InteractionJoinNotFound{}
}
/*InteractionJoinNotFound handles this case with default header values.
VirtualDevice not found
*/
type InteractionJoinNotFound struct {
Payload *models.Error
}
func (o *InteractionJoinNotFound) Error() string {
return fmt.Sprintf("[POST /interaction][%d] interactionJoinNotFound %+v", 404, o.Payload)
}
func (o *InteractionJoinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewInteractionJoinInternalServerError creates a InteractionJoinInternalServerError with default headers values
func NewInteractionJoinInternalServerError() *InteractionJoinInternalServerError {
return &InteractionJoinInternalServerError{}
}
/*InteractionJoinInternalServerError handles this case with default header values.
Adding a VirtualDevice failed
*/
type InteractionJoinInternalServerError struct {
Payload *models.Error
}
func (o *InteractionJoinInternalServerError) Error() string {
return fmt.Sprintf("[POST /interaction][%d] interactionJoinInternalServerError %+v", 500, o.Payload)
}
func (o *InteractionJoinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package interaction
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewInteractionUnbindParams creates a new InteractionUnbindParams object
// with the default values initialized.
func NewInteractionUnbindParams() *InteractionUnbindParams {
var ()
return &InteractionUnbindParams{
timeout: cr.DefaultTimeout,
}
}
// NewInteractionUnbindParamsWithTimeout creates a new InteractionUnbindParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewInteractionUnbindParamsWithTimeout(timeout time.Duration) *InteractionUnbindParams {
var ()
return &InteractionUnbindParams{
timeout: timeout,
}
}
// NewInteractionUnbindParamsWithContext creates a new InteractionUnbindParams object
// with the default values initialized, and the ability to set a context for a request
func NewInteractionUnbindParamsWithContext(ctx context.Context) *InteractionUnbindParams {
var ()
return &InteractionUnbindParams{
Context: ctx,
}
}
// NewInteractionUnbindParamsWithHTTPClient creates a new InteractionUnbindParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewInteractionUnbindParamsWithHTTPClient(client *http.Client) *InteractionUnbindParams {
var ()
return &InteractionUnbindParams{
HTTPClient: client,
}
}
/*InteractionUnbindParams contains all the parameters to send to the API endpoint
for the interaction unbind operation typically these are written to a http.Request
*/
type InteractionUnbindParams struct {
/*Config*/
Config *models.InteractionUnbindConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the interaction unbind params
func (o *InteractionUnbindParams) WithTimeout(timeout time.Duration) *InteractionUnbindParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the interaction unbind params
func (o *InteractionUnbindParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the interaction unbind params
func (o *InteractionUnbindParams) WithContext(ctx context.Context) *InteractionUnbindParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the interaction unbind params
func (o *InteractionUnbindParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the interaction unbind params
func (o *InteractionUnbindParams) WithHTTPClient(client *http.Client) *InteractionUnbindParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the interaction unbind params
func (o *InteractionUnbindParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the interaction unbind params
func (o *InteractionUnbindParams) WithConfig(config *models.InteractionUnbindConfig) *InteractionUnbindParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the interaction unbind params
func (o *InteractionUnbindParams) SetConfig(config *models.InteractionUnbindConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *InteractionUnbindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.InteractionUnbindConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package interaction
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// InteractionUnbindReader is a Reader for the InteractionUnbind structure.
type InteractionUnbindReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *InteractionUnbindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewInteractionUnbindOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewInteractionUnbindNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewInteractionUnbindInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewInteractionUnbindOK creates a InteractionUnbindOK with default headers values
func NewInteractionUnbindOK() *InteractionUnbindOK {
return &InteractionUnbindOK{}
}
/*InteractionUnbindOK handles this case with default header values.
OK
*/
type InteractionUnbindOK struct {
Payload *models.InteractionUnbindResponse
}
func (o *InteractionUnbindOK) Error() string {
return fmt.Sprintf("[DELETE /interaction/binding][%d] interactionUnbindOK %+v", 200, o.Payload)
}
func (o *InteractionUnbindOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.InteractionUnbindResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewInteractionUnbindNotFound creates a InteractionUnbindNotFound with default headers values
func NewInteractionUnbindNotFound() *InteractionUnbindNotFound {
return &InteractionUnbindNotFound{}
}
/*InteractionUnbindNotFound handles this case with default header values.
VirtualDevice not found
*/
type InteractionUnbindNotFound struct {
Payload *models.Error
}
func (o *InteractionUnbindNotFound) Error() string {
return fmt.Sprintf("[DELETE /interaction/binding][%d] interactionUnbindNotFound %+v", 404, o.Payload)
}
func (o *InteractionUnbindNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewInteractionUnbindInternalServerError creates a InteractionUnbindInternalServerError with default headers values
func NewInteractionUnbindInternalServerError() *InteractionUnbindInternalServerError {
return &InteractionUnbindInternalServerError{}
}
/*InteractionUnbindInternalServerError handles this case with default header values.
Disconnecting VirtualDevice failed
*/
type InteractionUnbindInternalServerError struct {
Payload *models.Error
}
func (o *InteractionUnbindInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /interaction/binding][%d] interactionUnbindInternalServerError %+v", 500, o.Payload)
}
func (o *InteractionUnbindInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package kv
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteValueParams creates a new DeleteValueParams object
// with the default values initialized.
func NewDeleteValueParams() *DeleteValueParams {
var ()
return &DeleteValueParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteValueParamsWithTimeout creates a new DeleteValueParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteValueParamsWithTimeout(timeout time.Duration) *DeleteValueParams {
var ()
return &DeleteValueParams{
timeout: timeout,
}
}
// NewDeleteValueParamsWithContext creates a new DeleteValueParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteValueParamsWithContext(ctx context.Context) *DeleteValueParams {
var ()
return &DeleteValueParams{
Context: ctx,
}
}
// NewDeleteValueParamsWithHTTPClient creates a new DeleteValueParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteValueParamsWithHTTPClient(client *http.Client) *DeleteValueParams {
var ()
return &DeleteValueParams{
HTTPClient: client,
}
}
/*DeleteValueParams contains all the parameters to send to the API endpoint
for the delete value operation typically these are written to a http.Request
*/
type DeleteValueParams struct {
/*Key*/
Key string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete value params
func (o *DeleteValueParams) WithTimeout(timeout time.Duration) *DeleteValueParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete value params
func (o *DeleteValueParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete value params
func (o *DeleteValueParams) WithContext(ctx context.Context) *DeleteValueParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete value params
func (o *DeleteValueParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete value params
func (o *DeleteValueParams) WithHTTPClient(client *http.Client) *DeleteValueParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete value params
func (o *DeleteValueParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithKey adds the key to the delete value params
func (o *DeleteValueParams) WithKey(key string) *DeleteValueParams {
o.SetKey(key)
return o
}
// SetKey adds the key to the delete value params
func (o *DeleteValueParams) SetKey(key string) {
o.Key = key
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteValueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param key
if err := r.SetPathParam("key", o.Key); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,121 @@
package kv
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// DeleteValueReader is a Reader for the DeleteValue structure.
type DeleteValueReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteValueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteValueOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteValueNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewDeleteValueInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewDeleteValueOK creates a DeleteValueOK with default headers values
func NewDeleteValueOK() *DeleteValueOK {
return &DeleteValueOK{}
}
/*DeleteValueOK handles this case with default header values.
OK
*/
type DeleteValueOK struct {
}
func (o *DeleteValueOK) Error() string {
return fmt.Sprintf("[DELETE /kv/{key}][%d] deleteValueOK ", 200)
}
func (o *DeleteValueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteValueNotFound creates a DeleteValueNotFound with default headers values
func NewDeleteValueNotFound() *DeleteValueNotFound {
return &DeleteValueNotFound{}
}
/*DeleteValueNotFound handles this case with default header values.
Not found
*/
type DeleteValueNotFound struct {
}
func (o *DeleteValueNotFound) Error() string {
return fmt.Sprintf("[DELETE /kv/{key}][%d] deleteValueNotFound ", 404)
}
func (o *DeleteValueNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteValueInternalServerError creates a DeleteValueInternalServerError with default headers values
func NewDeleteValueInternalServerError() *DeleteValueInternalServerError {
return &DeleteValueInternalServerError{}
}
/*DeleteValueInternalServerError handles this case with default header values.
error
*/
type DeleteValueInternalServerError struct {
Payload *models.Error
}
func (o *DeleteValueInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /kv/{key}][%d] deleteValueInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteValueInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package kv
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetValueParams creates a new GetValueParams object
// with the default values initialized.
func NewGetValueParams() *GetValueParams {
var ()
return &GetValueParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetValueParamsWithTimeout creates a new GetValueParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetValueParamsWithTimeout(timeout time.Duration) *GetValueParams {
var ()
return &GetValueParams{
timeout: timeout,
}
}
// NewGetValueParamsWithContext creates a new GetValueParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetValueParamsWithContext(ctx context.Context) *GetValueParams {
var ()
return &GetValueParams{
Context: ctx,
}
}
// NewGetValueParamsWithHTTPClient creates a new GetValueParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetValueParamsWithHTTPClient(client *http.Client) *GetValueParams {
var ()
return &GetValueParams{
HTTPClient: client,
}
}
/*GetValueParams contains all the parameters to send to the API endpoint
for the get value operation typically these are written to a http.Request
*/
type GetValueParams struct {
/*Key*/
Key string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get value params
func (o *GetValueParams) WithTimeout(timeout time.Duration) *GetValueParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get value params
func (o *GetValueParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get value params
func (o *GetValueParams) WithContext(ctx context.Context) *GetValueParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get value params
func (o *GetValueParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get value params
func (o *GetValueParams) WithHTTPClient(client *http.Client) *GetValueParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get value params
func (o *GetValueParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithKey adds the key to the get value params
func (o *GetValueParams) WithKey(key string) *GetValueParams {
o.SetKey(key)
return o
}
// SetKey adds the key to the get value params
func (o *GetValueParams) SetKey(key string) {
o.Key = key
}
// WriteToRequest writes these params to a swagger request
func (o *GetValueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param key
if err := r.SetPathParam("key", o.Key); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,129 @@
package kv
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetValueReader is a Reader for the GetValue structure.
type GetValueReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetValueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetValueOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetValueNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetValueInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetValueOK creates a GetValueOK with default headers values
func NewGetValueOK() *GetValueOK {
return &GetValueOK{}
}
/*GetValueOK handles this case with default header values.
OK
*/
type GetValueOK struct {
Payload *models.KeyValue
}
func (o *GetValueOK) Error() string {
return fmt.Sprintf("[GET /kv/{key}][%d] getValueOK %+v", 200, o.Payload)
}
func (o *GetValueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.KeyValue)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetValueNotFound creates a GetValueNotFound with default headers values
func NewGetValueNotFound() *GetValueNotFound {
return &GetValueNotFound{}
}
/*GetValueNotFound handles this case with default header values.
Not found
*/
type GetValueNotFound struct {
}
func (o *GetValueNotFound) Error() string {
return fmt.Sprintf("[GET /kv/{key}][%d] getValueNotFound ", 404)
}
func (o *GetValueNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetValueInternalServerError creates a GetValueInternalServerError with default headers values
func NewGetValueInternalServerError() *GetValueInternalServerError {
return &GetValueInternalServerError{}
}
/*GetValueInternalServerError handles this case with default header values.
error
*/
type GetValueInternalServerError struct {
Payload *models.Error
}
func (o *GetValueInternalServerError) Error() string {
return fmt.Sprintf("[GET /kv/{key}][%d] getValueInternalServerError %+v", 500, o.Payload)
}
func (o *GetValueInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,112 @@
package kv
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new kv API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for kv API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
DeleteValue deletes entry in k/v store
*/
func (a *Client) DeleteValue(params *DeleteValueParams) (*DeleteValueOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteValueParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteValue",
Method: "DELETE",
PathPattern: "/kv/{key}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteValueReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteValueOK), nil
}
/*
GetValue Gets value from k/v store
*/
func (a *Client) GetValue(params *GetValueParams) (*GetValueOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetValueParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetValue",
Method: "GET",
PathPattern: "/kv/{key}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetValueReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetValueOK), nil
}
/*
PutValue Adds / updates value in k/v store
*/
func (a *Client) PutValue(params *PutValueParams) (*PutValueOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPutValueParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PutValue",
Method: "PUT",
PathPattern: "/kv/{key}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PutValueReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PutValueOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,153 @@
package kv
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewPutValueParams creates a new PutValueParams object
// with the default values initialized.
func NewPutValueParams() *PutValueParams {
var ()
return &PutValueParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutValueParamsWithTimeout creates a new PutValueParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPutValueParamsWithTimeout(timeout time.Duration) *PutValueParams {
var ()
return &PutValueParams{
timeout: timeout,
}
}
// NewPutValueParamsWithContext creates a new PutValueParams object
// with the default values initialized, and the ability to set a context for a request
func NewPutValueParamsWithContext(ctx context.Context) *PutValueParams {
var ()
return &PutValueParams{
Context: ctx,
}
}
// NewPutValueParamsWithHTTPClient creates a new PutValueParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPutValueParamsWithHTTPClient(client *http.Client) *PutValueParams {
var ()
return &PutValueParams{
HTTPClient: client,
}
}
/*PutValueParams contains all the parameters to send to the API endpoint
for the put value operation typically these are written to a http.Request
*/
type PutValueParams struct {
/*Key*/
Key string
/*KeyValue*/
KeyValue *models.KeyValue
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the put value params
func (o *PutValueParams) WithTimeout(timeout time.Duration) *PutValueParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put value params
func (o *PutValueParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the put value params
func (o *PutValueParams) WithContext(ctx context.Context) *PutValueParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put value params
func (o *PutValueParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put value params
func (o *PutValueParams) WithHTTPClient(client *http.Client) *PutValueParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put value params
func (o *PutValueParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithKey adds the key to the put value params
func (o *PutValueParams) WithKey(key string) *PutValueParams {
o.SetKey(key)
return o
}
// SetKey adds the key to the put value params
func (o *PutValueParams) SetKey(key string) {
o.Key = key
}
// WithKeyValue adds the keyValue to the put value params
func (o *PutValueParams) WithKeyValue(keyValue *models.KeyValue) *PutValueParams {
o.SetKeyValue(keyValue)
return o
}
// SetKeyValue adds the keyValue to the put value params
func (o *PutValueParams) SetKeyValue(keyValue *models.KeyValue) {
o.KeyValue = keyValue
}
// WriteToRequest writes these params to a swagger request
func (o *PutValueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param key
if err := r.SetPathParam("key", o.Key); err != nil {
return err
}
if o.KeyValue == nil {
o.KeyValue = new(models.KeyValue)
}
if err := r.SetBodyParam(o.KeyValue); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,93 @@
package kv
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// PutValueReader is a Reader for the PutValue structure.
type PutValueReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PutValueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutValueOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewPutValueInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewPutValueOK creates a PutValueOK with default headers values
func NewPutValueOK() *PutValueOK {
return &PutValueOK{}
}
/*PutValueOK handles this case with default header values.
OK
*/
type PutValueOK struct {
}
func (o *PutValueOK) Error() string {
return fmt.Sprintf("[PUT /kv/{key}][%d] putValueOK ", 200)
}
func (o *PutValueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPutValueInternalServerError creates a PutValueInternalServerError with default headers values
func NewPutValueInternalServerError() *PutValueInternalServerError {
return &PutValueInternalServerError{}
}
/*PutValueInternalServerError handles this case with default header values.
error
*/
type PutValueInternalServerError struct {
Payload *models.Error
}
func (o *PutValueInternalServerError) Error() string {
return fmt.Sprintf("[PUT /kv/{key}][%d] putValueInternalServerError %+v", 500, o.Payload)
}
func (o *PutValueInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package logging
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewLoggingBindParams creates a new LoggingBindParams object
// with the default values initialized.
func NewLoggingBindParams() *LoggingBindParams {
var ()
return &LoggingBindParams{
timeout: cr.DefaultTimeout,
}
}
// NewLoggingBindParamsWithTimeout creates a new LoggingBindParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewLoggingBindParamsWithTimeout(timeout time.Duration) *LoggingBindParams {
var ()
return &LoggingBindParams{
timeout: timeout,
}
}
// NewLoggingBindParamsWithContext creates a new LoggingBindParams object
// with the default values initialized, and the ability to set a context for a request
func NewLoggingBindParamsWithContext(ctx context.Context) *LoggingBindParams {
var ()
return &LoggingBindParams{
Context: ctx,
}
}
// NewLoggingBindParamsWithHTTPClient creates a new LoggingBindParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewLoggingBindParamsWithHTTPClient(client *http.Client) *LoggingBindParams {
var ()
return &LoggingBindParams{
HTTPClient: client,
}
}
/*LoggingBindParams contains all the parameters to send to the API endpoint
for the logging bind operation typically these are written to a http.Request
*/
type LoggingBindParams struct {
/*Config*/
Config *models.LoggingBindConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the logging bind params
func (o *LoggingBindParams) WithTimeout(timeout time.Duration) *LoggingBindParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the logging bind params
func (o *LoggingBindParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the logging bind params
func (o *LoggingBindParams) WithContext(ctx context.Context) *LoggingBindParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the logging bind params
func (o *LoggingBindParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the logging bind params
func (o *LoggingBindParams) WithHTTPClient(client *http.Client) *LoggingBindParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the logging bind params
func (o *LoggingBindParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the logging bind params
func (o *LoggingBindParams) WithConfig(config *models.LoggingBindConfig) *LoggingBindParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the logging bind params
func (o *LoggingBindParams) SetConfig(config *models.LoggingBindConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *LoggingBindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.LoggingBindConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package logging
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// LoggingBindReader is a Reader for the LoggingBind structure.
type LoggingBindReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *LoggingBindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewLoggingBindOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewLoggingBindNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewLoggingBindInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewLoggingBindOK creates a LoggingBindOK with default headers values
func NewLoggingBindOK() *LoggingBindOK {
return &LoggingBindOK{}
}
/*LoggingBindOK handles this case with default header values.
OK
*/
type LoggingBindOK struct {
Payload *models.LoggingBindResponse
}
func (o *LoggingBindOK) Error() string {
return fmt.Sprintf("[POST /logging/binding][%d] loggingBindOK %+v", 200, o.Payload)
}
func (o *LoggingBindOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.LoggingBindResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewLoggingBindNotFound creates a LoggingBindNotFound with default headers values
func NewLoggingBindNotFound() *LoggingBindNotFound {
return &LoggingBindNotFound{}
}
/*LoggingBindNotFound handles this case with default header values.
VirtualDevice not found
*/
type LoggingBindNotFound struct {
Payload *models.Error
}
func (o *LoggingBindNotFound) Error() string {
return fmt.Sprintf("[POST /logging/binding][%d] loggingBindNotFound %+v", 404, o.Payload)
}
func (o *LoggingBindNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewLoggingBindInternalServerError creates a LoggingBindInternalServerError with default headers values
func NewLoggingBindInternalServerError() *LoggingBindInternalServerError {
return &LoggingBindInternalServerError{}
}
/*LoggingBindInternalServerError handles this case with default header values.
Connecting VirtualDevice failed
*/
type LoggingBindInternalServerError struct {
Payload *models.Error
}
func (o *LoggingBindInternalServerError) Error() string {
return fmt.Sprintf("[POST /logging/binding][%d] loggingBindInternalServerError %+v", 500, o.Payload)
}
func (o *LoggingBindInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,118 @@
package logging
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new logging API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for logging API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
LoggingBind enables bind activate the virtual device
Enable/bind/activate the VirtualDevice
*/
func (a *Client) LoggingBind(params *LoggingBindParams) (*LoggingBindOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewLoggingBindParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "LoggingBind",
Method: "POST",
PathPattern: "/logging/binding",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &LoggingBindReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*LoggingBindOK), nil
}
/*
LoggingJoin adds logging capability
Adds logging capabilities to given handle
*/
func (a *Client) LoggingJoin(params *LoggingJoinParams) (*LoggingJoinOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewLoggingJoinParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "LoggingJoin",
Method: "POST",
PathPattern: "/logging",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &LoggingJoinReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*LoggingJoinOK), nil
}
/*
LoggingUnbind disables unbind deactivate the virtual device
Disable/unbind/deactivate the VirtualDevice
*/
func (a *Client) LoggingUnbind(params *LoggingUnbindParams) (*LoggingUnbindOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewLoggingUnbindParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "LoggingUnbind",
Method: "DELETE",
PathPattern: "/logging/binding",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &LoggingUnbindReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*LoggingUnbindOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,135 @@
package logging
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewLoggingJoinParams creates a new LoggingJoinParams object
// with the default values initialized.
func NewLoggingJoinParams() *LoggingJoinParams {
var ()
return &LoggingJoinParams{
timeout: cr.DefaultTimeout,
}
}
// NewLoggingJoinParamsWithTimeout creates a new LoggingJoinParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewLoggingJoinParamsWithTimeout(timeout time.Duration) *LoggingJoinParams {
var ()
return &LoggingJoinParams{
timeout: timeout,
}
}
// NewLoggingJoinParamsWithContext creates a new LoggingJoinParams object
// with the default values initialized, and the ability to set a context for a request
func NewLoggingJoinParamsWithContext(ctx context.Context) *LoggingJoinParams {
var ()
return &LoggingJoinParams{
Context: ctx,
}
}
// NewLoggingJoinParamsWithHTTPClient creates a new LoggingJoinParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewLoggingJoinParamsWithHTTPClient(client *http.Client) *LoggingJoinParams {
var ()
return &LoggingJoinParams{
HTTPClient: client,
}
}
/*LoggingJoinParams contains all the parameters to send to the API endpoint
for the logging join operation typically these are written to a http.Request
*/
type LoggingJoinParams struct {
/*Config*/
Config *models.LoggingJoinConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the logging join params
func (o *LoggingJoinParams) WithTimeout(timeout time.Duration) *LoggingJoinParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the logging join params
func (o *LoggingJoinParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the logging join params
func (o *LoggingJoinParams) WithContext(ctx context.Context) *LoggingJoinParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the logging join params
func (o *LoggingJoinParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the logging join params
func (o *LoggingJoinParams) WithHTTPClient(client *http.Client) *LoggingJoinParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the logging join params
func (o *LoggingJoinParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the logging join params
func (o *LoggingJoinParams) WithConfig(config *models.LoggingJoinConfig) *LoggingJoinParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the logging join params
func (o *LoggingJoinParams) SetConfig(config *models.LoggingJoinConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *LoggingJoinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.LoggingJoinConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package logging
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// LoggingJoinReader is a Reader for the LoggingJoin structure.
type LoggingJoinReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *LoggingJoinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewLoggingJoinOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewLoggingJoinNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewLoggingJoinInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewLoggingJoinOK creates a LoggingJoinOK with default headers values
func NewLoggingJoinOK() *LoggingJoinOK {
return &LoggingJoinOK{}
}
/*LoggingJoinOK handles this case with default header values.
OK
*/
type LoggingJoinOK struct {
Payload *models.LoggingJoinResponse
}
func (o *LoggingJoinOK) Error() string {
return fmt.Sprintf("[POST /logging][%d] loggingJoinOK %+v", 200, o.Payload)
}
func (o *LoggingJoinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.LoggingJoinResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewLoggingJoinNotFound creates a LoggingJoinNotFound with default headers values
func NewLoggingJoinNotFound() *LoggingJoinNotFound {
return &LoggingJoinNotFound{}
}
/*LoggingJoinNotFound handles this case with default header values.
VirtualDevice not found
*/
type LoggingJoinNotFound struct {
Payload *models.Error
}
func (o *LoggingJoinNotFound) Error() string {
return fmt.Sprintf("[POST /logging][%d] loggingJoinNotFound %+v", 404, o.Payload)
}
func (o *LoggingJoinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewLoggingJoinInternalServerError creates a LoggingJoinInternalServerError with default headers values
func NewLoggingJoinInternalServerError() *LoggingJoinInternalServerError {
return &LoggingJoinInternalServerError{}
}
/*LoggingJoinInternalServerError handles this case with default header values.
Adding a VirtualDevice failed
*/
type LoggingJoinInternalServerError struct {
Payload *models.Error
}
func (o *LoggingJoinInternalServerError) Error() string {
return fmt.Sprintf("[POST /logging][%d] loggingJoinInternalServerError %+v", 500, o.Payload)
}
func (o *LoggingJoinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package logging
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewLoggingUnbindParams creates a new LoggingUnbindParams object
// with the default values initialized.
func NewLoggingUnbindParams() *LoggingUnbindParams {
var ()
return &LoggingUnbindParams{
timeout: cr.DefaultTimeout,
}
}
// NewLoggingUnbindParamsWithTimeout creates a new LoggingUnbindParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewLoggingUnbindParamsWithTimeout(timeout time.Duration) *LoggingUnbindParams {
var ()
return &LoggingUnbindParams{
timeout: timeout,
}
}
// NewLoggingUnbindParamsWithContext creates a new LoggingUnbindParams object
// with the default values initialized, and the ability to set a context for a request
func NewLoggingUnbindParamsWithContext(ctx context.Context) *LoggingUnbindParams {
var ()
return &LoggingUnbindParams{
Context: ctx,
}
}
// NewLoggingUnbindParamsWithHTTPClient creates a new LoggingUnbindParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewLoggingUnbindParamsWithHTTPClient(client *http.Client) *LoggingUnbindParams {
var ()
return &LoggingUnbindParams{
HTTPClient: client,
}
}
/*LoggingUnbindParams contains all the parameters to send to the API endpoint
for the logging unbind operation typically these are written to a http.Request
*/
type LoggingUnbindParams struct {
/*Config*/
Config *models.LoggingUnbindConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the logging unbind params
func (o *LoggingUnbindParams) WithTimeout(timeout time.Duration) *LoggingUnbindParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the logging unbind params
func (o *LoggingUnbindParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the logging unbind params
func (o *LoggingUnbindParams) WithContext(ctx context.Context) *LoggingUnbindParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the logging unbind params
func (o *LoggingUnbindParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the logging unbind params
func (o *LoggingUnbindParams) WithHTTPClient(client *http.Client) *LoggingUnbindParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the logging unbind params
func (o *LoggingUnbindParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the logging unbind params
func (o *LoggingUnbindParams) WithConfig(config *models.LoggingUnbindConfig) *LoggingUnbindParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the logging unbind params
func (o *LoggingUnbindParams) SetConfig(config *models.LoggingUnbindConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *LoggingUnbindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.LoggingUnbindConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package logging
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// LoggingUnbindReader is a Reader for the LoggingUnbind structure.
type LoggingUnbindReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *LoggingUnbindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewLoggingUnbindOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewLoggingUnbindNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewLoggingUnbindInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewLoggingUnbindOK creates a LoggingUnbindOK with default headers values
func NewLoggingUnbindOK() *LoggingUnbindOK {
return &LoggingUnbindOK{}
}
/*LoggingUnbindOK handles this case with default header values.
OK
*/
type LoggingUnbindOK struct {
Payload *models.LoggingUnbindResponse
}
func (o *LoggingUnbindOK) Error() string {
return fmt.Sprintf("[DELETE /logging/binding][%d] loggingUnbindOK %+v", 200, o.Payload)
}
func (o *LoggingUnbindOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.LoggingUnbindResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewLoggingUnbindNotFound creates a LoggingUnbindNotFound with default headers values
func NewLoggingUnbindNotFound() *LoggingUnbindNotFound {
return &LoggingUnbindNotFound{}
}
/*LoggingUnbindNotFound handles this case with default header values.
VirtualDevice not found
*/
type LoggingUnbindNotFound struct {
Payload *models.Error
}
func (o *LoggingUnbindNotFound) Error() string {
return fmt.Sprintf("[DELETE /logging/binding][%d] loggingUnbindNotFound %+v", 404, o.Payload)
}
func (o *LoggingUnbindNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewLoggingUnbindInternalServerError creates a LoggingUnbindInternalServerError with default headers values
func NewLoggingUnbindInternalServerError() *LoggingUnbindInternalServerError {
return &LoggingUnbindInternalServerError{}
}
/*LoggingUnbindInternalServerError handles this case with default header values.
Disconnecting VirtualDevice failed
*/
type LoggingUnbindInternalServerError struct {
Payload *models.Error
}
func (o *LoggingUnbindInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /logging/binding][%d] loggingUnbindInternalServerError %+v", 500, o.Payload)
}
func (o *LoggingUnbindInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,110 @@
package misc
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetVCHInfoParams creates a new GetVCHInfoParams object
// with the default values initialized.
func NewGetVCHInfoParams() *GetVCHInfoParams {
return &GetVCHInfoParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetVCHInfoParamsWithTimeout creates a new GetVCHInfoParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetVCHInfoParamsWithTimeout(timeout time.Duration) *GetVCHInfoParams {
return &GetVCHInfoParams{
timeout: timeout,
}
}
// NewGetVCHInfoParamsWithContext creates a new GetVCHInfoParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetVCHInfoParamsWithContext(ctx context.Context) *GetVCHInfoParams {
return &GetVCHInfoParams{
Context: ctx,
}
}
// NewGetVCHInfoParamsWithHTTPClient creates a new GetVCHInfoParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetVCHInfoParamsWithHTTPClient(client *http.Client) *GetVCHInfoParams {
return &GetVCHInfoParams{
HTTPClient: client,
}
}
/*GetVCHInfoParams contains all the parameters to send to the API endpoint
for the get v c h info operation typically these are written to a http.Request
*/
type GetVCHInfoParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get v c h info params
func (o *GetVCHInfoParams) WithTimeout(timeout time.Duration) *GetVCHInfoParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get v c h info params
func (o *GetVCHInfoParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get v c h info params
func (o *GetVCHInfoParams) WithContext(ctx context.Context) *GetVCHInfoParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get v c h info params
func (o *GetVCHInfoParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get v c h info params
func (o *GetVCHInfoParams) WithHTTPClient(client *http.Client) *GetVCHInfoParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get v c h info params
func (o *GetVCHInfoParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetVCHInfoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,65 @@
package misc
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetVCHInfoReader is a Reader for the GetVCHInfo structure.
type GetVCHInfoReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetVCHInfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetVCHInfoOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetVCHInfoOK creates a GetVCHInfoOK with default headers values
func NewGetVCHInfoOK() *GetVCHInfoOK {
return &GetVCHInfoOK{}
}
/*GetVCHInfoOK handles this case with default header values.
retrieval success
*/
type GetVCHInfoOK struct {
Payload *models.VCHInfo
}
func (o *GetVCHInfoOK) Error() string {
return fmt.Sprintf("[GET /vch/info][%d] getVCHInfoOK %+v", 200, o.Payload)
}
func (o *GetVCHInfoOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.VCHInfo)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,86 @@
package misc
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new misc API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for misc API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
GetVCHInfo Gets vital information about the vch
*/
func (a *Client) GetVCHInfo(params *GetVCHInfoParams) (*GetVCHInfoOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetVCHInfoParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetVCHInfo",
Method: "GET",
PathPattern: "/vch/info",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetVCHInfoReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetVCHInfoOK), nil
}
/*
Ping pings the portlayer server
Pings the server to see if it's running
*/
func (a *Client) Ping(params *PingParams) (*PingOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPingParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Ping",
Method: "GET",
PathPattern: "/_ping",
ProducesMediaTypes: []string{"text/plain"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PingReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PingOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,110 @@
package misc
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewPingParams creates a new PingParams object
// with the default values initialized.
func NewPingParams() *PingParams {
return &PingParams{
timeout: cr.DefaultTimeout,
}
}
// NewPingParamsWithTimeout creates a new PingParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPingParamsWithTimeout(timeout time.Duration) *PingParams {
return &PingParams{
timeout: timeout,
}
}
// NewPingParamsWithContext creates a new PingParams object
// with the default values initialized, and the ability to set a context for a request
func NewPingParamsWithContext(ctx context.Context) *PingParams {
return &PingParams{
Context: ctx,
}
}
// NewPingParamsWithHTTPClient creates a new PingParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPingParamsWithHTTPClient(client *http.Client) *PingParams {
return &PingParams{
HTTPClient: client,
}
}
/*PingParams contains all the parameters to send to the API endpoint
for the ping operation typically these are written to a http.Request
*/
type PingParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the ping params
func (o *PingParams) WithTimeout(timeout time.Duration) *PingParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the ping params
func (o *PingParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the ping params
func (o *PingParams) WithContext(ctx context.Context) *PingParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the ping params
func (o *PingParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the ping params
func (o *PingParams) WithHTTPClient(client *http.Client) *PingParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the ping params
func (o *PingParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *PingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,61 @@
package misc
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// PingReader is a Reader for the Ping structure.
type PingReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPingOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewPingOK creates a PingOK with default headers values
func NewPingOK() *PingOK {
return &PingOK{}
}
/*PingOK handles this case with default header values.
OK
*/
type PingOK struct {
Payload string
}
func (o *PingOK) Error() string {
return fmt.Sprintf("[GET /_ping][%d] pingOK %+v", 200, o.Payload)
}
func (o *PingOK) 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
}

View File

@@ -0,0 +1,169 @@
package client
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/client/containers"
"github.com/vmware/vic/lib/apiservers/portlayer/client/events"
"github.com/vmware/vic/lib/apiservers/portlayer/client/interaction"
"github.com/vmware/vic/lib/apiservers/portlayer/client/kv"
"github.com/vmware/vic/lib/apiservers/portlayer/client/logging"
"github.com/vmware/vic/lib/apiservers/portlayer/client/misc"
"github.com/vmware/vic/lib/apiservers/portlayer/client/scopes"
"github.com/vmware/vic/lib/apiservers/portlayer/client/storage"
"github.com/vmware/vic/lib/apiservers/portlayer/client/tasks"
)
// Default port layer HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "localhost"
// DefaultBasePath is the default BasePath
// found in Meta (info) section of spec file
DefaultBasePath string = "/"
)
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http"}
// NewHTTPClient creates a new port layer HTTP client.
func NewHTTPClient(formats strfmt.Registry) *PortLayer {
return NewHTTPClientWithConfig(formats, nil)
}
// NewHTTPClientWithConfig creates a new port layer HTTP client,
// using a customizable transport config.
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *PortLayer {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
}
if cfg == nil {
cfg = DefaultTransportConfig()
}
// create transport and client
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
return New(transport, formats)
}
// New creates a new port layer client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *PortLayer {
cli := new(PortLayer)
cli.Transport = transport
cli.Containers = containers.New(transport, formats)
cli.Events = events.New(transport, formats)
cli.Interaction = interaction.New(transport, formats)
cli.Kv = kv.New(transport, formats)
cli.Logging = logging.New(transport, formats)
cli.Misc = misc.New(transport, formats)
cli.Scopes = scopes.New(transport, formats)
cli.Storage = storage.New(transport, formats)
cli.Tasks = tasks.New(transport, formats)
return cli
}
// DefaultTransportConfig creates a TransportConfig with the
// default settings taken from the meta section of the spec file.
func DefaultTransportConfig() *TransportConfig {
return &TransportConfig{
Host: DefaultHost,
BasePath: DefaultBasePath,
Schemes: DefaultSchemes,
}
}
// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
Host string
BasePath string
Schemes []string
}
// WithHost overrides the default host,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
cfg.Host = host
return cfg
}
// WithBasePath overrides the default basePath,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
cfg.BasePath = basePath
return cfg
}
// WithSchemes overrides the default schemes,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
cfg.Schemes = schemes
return cfg
}
// PortLayer is a client for port layer
type PortLayer struct {
Containers *containers.Client
Events *events.Client
Interaction *interaction.Client
Kv *kv.Client
Logging *logging.Client
Misc *misc.Client
Scopes *scopes.Client
Storage *storage.Client
Tasks *tasks.Client
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *PortLayer) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Containers.SetTransport(transport)
c.Events.SetTransport(transport)
c.Interaction.SetTransport(transport)
c.Kv.SetTransport(transport)
c.Logging.SetTransport(transport)
c.Misc.SetTransport(transport)
c.Scopes.SetTransport(transport)
c.Storage.SetTransport(transport)
c.Tasks.SetTransport(transport)
}

View File

@@ -0,0 +1,153 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewAddContainerParams creates a new AddContainerParams object
// with the default values initialized.
func NewAddContainerParams() *AddContainerParams {
var ()
return &AddContainerParams{
timeout: cr.DefaultTimeout,
}
}
// NewAddContainerParamsWithTimeout creates a new AddContainerParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewAddContainerParamsWithTimeout(timeout time.Duration) *AddContainerParams {
var ()
return &AddContainerParams{
timeout: timeout,
}
}
// NewAddContainerParamsWithContext creates a new AddContainerParams object
// with the default values initialized, and the ability to set a context for a request
func NewAddContainerParamsWithContext(ctx context.Context) *AddContainerParams {
var ()
return &AddContainerParams{
Context: ctx,
}
}
// NewAddContainerParamsWithHTTPClient creates a new AddContainerParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewAddContainerParamsWithHTTPClient(client *http.Client) *AddContainerParams {
var ()
return &AddContainerParams{
HTTPClient: client,
}
}
/*AddContainerParams contains all the parameters to send to the API endpoint
for the add container operation typically these are written to a http.Request
*/
type AddContainerParams struct {
/*Config*/
Config *models.ScopesAddContainerConfig
/*Scope*/
Scope string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the add container params
func (o *AddContainerParams) WithTimeout(timeout time.Duration) *AddContainerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the add container params
func (o *AddContainerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the add container params
func (o *AddContainerParams) WithContext(ctx context.Context) *AddContainerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the add container params
func (o *AddContainerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the add container params
func (o *AddContainerParams) WithHTTPClient(client *http.Client) *AddContainerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the add container params
func (o *AddContainerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the add container params
func (o *AddContainerParams) WithConfig(config *models.ScopesAddContainerConfig) *AddContainerParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the add container params
func (o *AddContainerParams) SetConfig(config *models.ScopesAddContainerConfig) {
o.Config = config
}
// WithScope adds the scope to the add container params
func (o *AddContainerParams) WithScope(scope string) *AddContainerParams {
o.SetScope(scope)
return o
}
// SetScope adds the scope to the add container params
func (o *AddContainerParams) SetScope(scope string) {
o.Scope = scope
}
// WriteToRequest writes these params to a swagger request
func (o *AddContainerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.ScopesAddContainerConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
// path param scope
if err := r.SetPathParam("scope", o.Scope); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// AddContainerReader is a Reader for the AddContainer structure.
type AddContainerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AddContainerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewAddContainerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewAddContainerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewAddContainerInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewAddContainerOK creates a AddContainerOK with default headers values
func NewAddContainerOK() *AddContainerOK {
return &AddContainerOK{}
}
/*AddContainerOK handles this case with default header values.
OK
*/
type AddContainerOK struct {
Payload string
}
func (o *AddContainerOK) Error() string {
return fmt.Sprintf("[POST /scopes/{scope}/containers][%d] addContainerOK %+v", 200, o.Payload)
}
func (o *AddContainerOK) 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
}
// NewAddContainerNotFound creates a AddContainerNotFound with default headers values
func NewAddContainerNotFound() *AddContainerNotFound {
return &AddContainerNotFound{}
}
/*AddContainerNotFound handles this case with default header values.
Not found
*/
type AddContainerNotFound struct {
Payload *models.Error
}
func (o *AddContainerNotFound) Error() string {
return fmt.Sprintf("[POST /scopes/{scope}/containers][%d] addContainerNotFound %+v", 404, o.Payload)
}
func (o *AddContainerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewAddContainerInternalServerError creates a AddContainerInternalServerError with default headers values
func NewAddContainerInternalServerError() *AddContainerInternalServerError {
return &AddContainerInternalServerError{}
}
/*AddContainerInternalServerError handles this case with default header values.
error
*/
type AddContainerInternalServerError struct {
Payload *models.Error
}
func (o *AddContainerInternalServerError) Error() string {
return fmt.Sprintf("[POST /scopes/{scope}/containers][%d] addContainerInternalServerError %+v", 500, o.Payload)
}
func (o *AddContainerInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewBindContainerParams creates a new BindContainerParams object
// with the default values initialized.
func NewBindContainerParams() *BindContainerParams {
var ()
return &BindContainerParams{
timeout: cr.DefaultTimeout,
}
}
// NewBindContainerParamsWithTimeout creates a new BindContainerParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewBindContainerParamsWithTimeout(timeout time.Duration) *BindContainerParams {
var ()
return &BindContainerParams{
timeout: timeout,
}
}
// NewBindContainerParamsWithContext creates a new BindContainerParams object
// with the default values initialized, and the ability to set a context for a request
func NewBindContainerParamsWithContext(ctx context.Context) *BindContainerParams {
var ()
return &BindContainerParams{
Context: ctx,
}
}
// NewBindContainerParamsWithHTTPClient creates a new BindContainerParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewBindContainerParamsWithHTTPClient(client *http.Client) *BindContainerParams {
var ()
return &BindContainerParams{
HTTPClient: client,
}
}
/*BindContainerParams contains all the parameters to send to the API endpoint
for the bind container operation typically these are written to a http.Request
*/
type BindContainerParams struct {
/*Handle*/
Handle string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the bind container params
func (o *BindContainerParams) WithTimeout(timeout time.Duration) *BindContainerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the bind container params
func (o *BindContainerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the bind container params
func (o *BindContainerParams) WithContext(ctx context.Context) *BindContainerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the bind container params
func (o *BindContainerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the bind container params
func (o *BindContainerParams) WithHTTPClient(client *http.Client) *BindContainerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the bind container params
func (o *BindContainerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the bind container params
func (o *BindContainerParams) WithHandle(handle string) *BindContainerParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the bind container params
func (o *BindContainerParams) SetHandle(handle string) {
o.Handle = handle
}
// WriteToRequest writes these params to a swagger request
func (o *BindContainerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// BindContainerReader is a Reader for the BindContainer structure.
type BindContainerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *BindContainerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewBindContainerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewBindContainerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewBindContainerInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewBindContainerOK creates a BindContainerOK with default headers values
func NewBindContainerOK() *BindContainerOK {
return &BindContainerOK{}
}
/*BindContainerOK handles this case with default header values.
OK
*/
type BindContainerOK struct {
Payload *models.BindContainerResponse
}
func (o *BindContainerOK) Error() string {
return fmt.Sprintf("[POST /scopes/containers/{handle}/binding][%d] bindContainerOK %+v", 200, o.Payload)
}
func (o *BindContainerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.BindContainerResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewBindContainerNotFound creates a BindContainerNotFound with default headers values
func NewBindContainerNotFound() *BindContainerNotFound {
return &BindContainerNotFound{}
}
/*BindContainerNotFound handles this case with default header values.
Not found
*/
type BindContainerNotFound struct {
Payload *models.Error
}
func (o *BindContainerNotFound) Error() string {
return fmt.Sprintf("[POST /scopes/containers/{handle}/binding][%d] bindContainerNotFound %+v", 404, o.Payload)
}
func (o *BindContainerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewBindContainerInternalServerError creates a BindContainerInternalServerError with default headers values
func NewBindContainerInternalServerError() *BindContainerInternalServerError {
return &BindContainerInternalServerError{}
}
/*BindContainerInternalServerError handles this case with default header values.
error
*/
type BindContainerInternalServerError struct {
Payload *models.Error
}
func (o *BindContainerInternalServerError) Error() string {
return fmt.Sprintf("[POST /scopes/containers/{handle}/binding][%d] bindContainerInternalServerError %+v", 500, o.Payload)
}
func (o *BindContainerInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewCreateScopeParams creates a new CreateScopeParams object
// with the default values initialized.
func NewCreateScopeParams() *CreateScopeParams {
var ()
return &CreateScopeParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateScopeParamsWithTimeout creates a new CreateScopeParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCreateScopeParamsWithTimeout(timeout time.Duration) *CreateScopeParams {
var ()
return &CreateScopeParams{
timeout: timeout,
}
}
// NewCreateScopeParamsWithContext creates a new CreateScopeParams object
// with the default values initialized, and the ability to set a context for a request
func NewCreateScopeParamsWithContext(ctx context.Context) *CreateScopeParams {
var ()
return &CreateScopeParams{
Context: ctx,
}
}
// NewCreateScopeParamsWithHTTPClient creates a new CreateScopeParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCreateScopeParamsWithHTTPClient(client *http.Client) *CreateScopeParams {
var ()
return &CreateScopeParams{
HTTPClient: client,
}
}
/*CreateScopeParams contains all the parameters to send to the API endpoint
for the create scope operation typically these are written to a http.Request
*/
type CreateScopeParams struct {
/*Config*/
Config *models.ScopeConfig
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the create scope params
func (o *CreateScopeParams) WithTimeout(timeout time.Duration) *CreateScopeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create scope params
func (o *CreateScopeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create scope params
func (o *CreateScopeParams) WithContext(ctx context.Context) *CreateScopeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create scope params
func (o *CreateScopeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create scope params
func (o *CreateScopeParams) WithHTTPClient(client *http.Client) *CreateScopeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create scope params
func (o *CreateScopeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithConfig adds the config to the create scope params
func (o *CreateScopeParams) WithConfig(config *models.ScopeConfig) *CreateScopeParams {
o.SetConfig(config)
return o
}
// SetConfig adds the config to the create scope params
func (o *CreateScopeParams) SetConfig(config *models.ScopeConfig) {
o.Config = config
}
// WriteToRequest writes these params to a swagger request
func (o *CreateScopeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Config == nil {
o.Config = new(models.ScopeConfig)
}
if err := r.SetBodyParam(o.Config); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,146 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// CreateScopeReader is a Reader for the CreateScope structure.
type CreateScopeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateScopeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewCreateScopeCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 409:
result := NewCreateScopeConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewCreateScopeDefault(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
}
}
// NewCreateScopeCreated creates a CreateScopeCreated with default headers values
func NewCreateScopeCreated() *CreateScopeCreated {
return &CreateScopeCreated{}
}
/*CreateScopeCreated handles this case with default header values.
Created
*/
type CreateScopeCreated struct {
Payload *models.ScopeConfig
}
func (o *CreateScopeCreated) Error() string {
return fmt.Sprintf("[POST /scopes][%d] createScopeCreated %+v", 201, o.Payload)
}
func (o *CreateScopeCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ScopeConfig)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateScopeConflict creates a CreateScopeConflict with default headers values
func NewCreateScopeConflict() *CreateScopeConflict {
return &CreateScopeConflict{}
}
/*CreateScopeConflict handles this case with default header values.
A scope with that name exists.
*/
type CreateScopeConflict struct {
Payload *models.Error
}
func (o *CreateScopeConflict) Error() string {
return fmt.Sprintf("[POST /scopes][%d] createScopeConflict %+v", 409, o.Payload)
}
func (o *CreateScopeConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateScopeDefault creates a CreateScopeDefault with default headers values
func NewCreateScopeDefault(code int) *CreateScopeDefault {
return &CreateScopeDefault{
_statusCode: code,
}
}
/*CreateScopeDefault handles this case with default header values.
error
*/
type CreateScopeDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the create scope default response
func (o *CreateScopeDefault) Code() int {
return o._statusCode
}
func (o *CreateScopeDefault) Error() string {
return fmt.Sprintf("[POST /scopes][%d] CreateScope default %+v", o._statusCode, o.Payload)
}
func (o *CreateScopeDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteScopeParams creates a new DeleteScopeParams object
// with the default values initialized.
func NewDeleteScopeParams() *DeleteScopeParams {
var ()
return &DeleteScopeParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteScopeParamsWithTimeout creates a new DeleteScopeParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteScopeParamsWithTimeout(timeout time.Duration) *DeleteScopeParams {
var ()
return &DeleteScopeParams{
timeout: timeout,
}
}
// NewDeleteScopeParamsWithContext creates a new DeleteScopeParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteScopeParamsWithContext(ctx context.Context) *DeleteScopeParams {
var ()
return &DeleteScopeParams{
Context: ctx,
}
}
// NewDeleteScopeParamsWithHTTPClient creates a new DeleteScopeParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteScopeParamsWithHTTPClient(client *http.Client) *DeleteScopeParams {
var ()
return &DeleteScopeParams{
HTTPClient: client,
}
}
/*DeleteScopeParams contains all the parameters to send to the API endpoint
for the delete scope operation typically these are written to a http.Request
*/
type DeleteScopeParams struct {
/*IDName*/
IDName string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete scope params
func (o *DeleteScopeParams) WithTimeout(timeout time.Duration) *DeleteScopeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete scope params
func (o *DeleteScopeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete scope params
func (o *DeleteScopeParams) WithContext(ctx context.Context) *DeleteScopeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete scope params
func (o *DeleteScopeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete scope params
func (o *DeleteScopeParams) WithHTTPClient(client *http.Client) *DeleteScopeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete scope params
func (o *DeleteScopeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithIDName adds the iDName to the delete scope params
func (o *DeleteScopeParams) WithIDName(iDName string) *DeleteScopeParams {
o.SetIDName(iDName)
return o
}
// SetIDName adds the idName to the delete scope params
func (o *DeleteScopeParams) SetIDName(iDName string) {
o.IDName = iDName
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteScopeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param idName
if err := r.SetPathParam("idName", o.IDName); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,129 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// DeleteScopeReader is a Reader for the DeleteScope structure.
type DeleteScopeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteScopeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteScopeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteScopeNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewDeleteScopeInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewDeleteScopeOK creates a DeleteScopeOK with default headers values
func NewDeleteScopeOK() *DeleteScopeOK {
return &DeleteScopeOK{}
}
/*DeleteScopeOK handles this case with default header values.
OK
*/
type DeleteScopeOK struct {
}
func (o *DeleteScopeOK) Error() string {
return fmt.Sprintf("[DELETE /scopes/{idName}][%d] deleteScopeOK ", 200)
}
func (o *DeleteScopeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteScopeNotFound creates a DeleteScopeNotFound with default headers values
func NewDeleteScopeNotFound() *DeleteScopeNotFound {
return &DeleteScopeNotFound{}
}
/*DeleteScopeNotFound handles this case with default header values.
Not found
*/
type DeleteScopeNotFound struct {
Payload *models.Error
}
func (o *DeleteScopeNotFound) Error() string {
return fmt.Sprintf("[DELETE /scopes/{idName}][%d] deleteScopeNotFound %+v", 404, o.Payload)
}
func (o *DeleteScopeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewDeleteScopeInternalServerError creates a DeleteScopeInternalServerError with default headers values
func NewDeleteScopeInternalServerError() *DeleteScopeInternalServerError {
return &DeleteScopeInternalServerError{}
}
/*DeleteScopeInternalServerError handles this case with default header values.
Internal server error
*/
type DeleteScopeInternalServerError struct {
Payload *models.Error
}
func (o *DeleteScopeInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /scopes/{idName}][%d] deleteScopeInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteScopeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetContainerEndpointsParams creates a new GetContainerEndpointsParams object
// with the default values initialized.
func NewGetContainerEndpointsParams() *GetContainerEndpointsParams {
var ()
return &GetContainerEndpointsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetContainerEndpointsParamsWithTimeout creates a new GetContainerEndpointsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetContainerEndpointsParamsWithTimeout(timeout time.Duration) *GetContainerEndpointsParams {
var ()
return &GetContainerEndpointsParams{
timeout: timeout,
}
}
// NewGetContainerEndpointsParamsWithContext creates a new GetContainerEndpointsParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetContainerEndpointsParamsWithContext(ctx context.Context) *GetContainerEndpointsParams {
var ()
return &GetContainerEndpointsParams{
Context: ctx,
}
}
// NewGetContainerEndpointsParamsWithHTTPClient creates a new GetContainerEndpointsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetContainerEndpointsParamsWithHTTPClient(client *http.Client) *GetContainerEndpointsParams {
var ()
return &GetContainerEndpointsParams{
HTTPClient: client,
}
}
/*GetContainerEndpointsParams contains all the parameters to send to the API endpoint
for the get container endpoints operation typically these are written to a http.Request
*/
type GetContainerEndpointsParams struct {
/*HandleOrID*/
HandleOrID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get container endpoints params
func (o *GetContainerEndpointsParams) WithTimeout(timeout time.Duration) *GetContainerEndpointsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get container endpoints params
func (o *GetContainerEndpointsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get container endpoints params
func (o *GetContainerEndpointsParams) WithContext(ctx context.Context) *GetContainerEndpointsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get container endpoints params
func (o *GetContainerEndpointsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get container endpoints params
func (o *GetContainerEndpointsParams) WithHTTPClient(client *http.Client) *GetContainerEndpointsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get container endpoints params
func (o *GetContainerEndpointsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandleOrID adds the handleOrID to the get container endpoints params
func (o *GetContainerEndpointsParams) WithHandleOrID(handleOrID string) *GetContainerEndpointsParams {
o.SetHandleOrID(handleOrID)
return o
}
// SetHandleOrID adds the handleOrId to the get container endpoints params
func (o *GetContainerEndpointsParams) SetHandleOrID(handleOrID string) {
o.HandleOrID = handleOrID
}
// WriteToRequest writes these params to a swagger request
func (o *GetContainerEndpointsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handleOrId
if err := r.SetPathParam("handleOrId", o.HandleOrID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetContainerEndpointsReader is a Reader for the GetContainerEndpoints structure.
type GetContainerEndpointsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetContainerEndpointsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetContainerEndpointsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetContainerEndpointsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetContainerEndpointsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetContainerEndpointsOK creates a GetContainerEndpointsOK with default headers values
func NewGetContainerEndpointsOK() *GetContainerEndpointsOK {
return &GetContainerEndpointsOK{}
}
/*GetContainerEndpointsOK handles this case with default header values.
OK
*/
type GetContainerEndpointsOK struct {
Payload []*models.EndpointConfig
}
func (o *GetContainerEndpointsOK) Error() string {
return fmt.Sprintf("[GET /scopes/containers/{handleOrId}][%d] getContainerEndpointsOK %+v", 200, o.Payload)
}
func (o *GetContainerEndpointsOK) 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
}
// NewGetContainerEndpointsNotFound creates a GetContainerEndpointsNotFound with default headers values
func NewGetContainerEndpointsNotFound() *GetContainerEndpointsNotFound {
return &GetContainerEndpointsNotFound{}
}
/*GetContainerEndpointsNotFound handles this case with default header values.
Not found
*/
type GetContainerEndpointsNotFound struct {
Payload *models.Error
}
func (o *GetContainerEndpointsNotFound) Error() string {
return fmt.Sprintf("[GET /scopes/containers/{handleOrId}][%d] getContainerEndpointsNotFound %+v", 404, o.Payload)
}
func (o *GetContainerEndpointsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetContainerEndpointsInternalServerError creates a GetContainerEndpointsInternalServerError with default headers values
func NewGetContainerEndpointsInternalServerError() *GetContainerEndpointsInternalServerError {
return &GetContainerEndpointsInternalServerError{}
}
/*GetContainerEndpointsInternalServerError handles this case with default header values.
error
*/
type GetContainerEndpointsInternalServerError struct {
Payload *models.Error
}
func (o *GetContainerEndpointsInternalServerError) Error() string {
return fmt.Sprintf("[GET /scopes/containers/{handleOrId}][%d] getContainerEndpointsInternalServerError %+v", 500, o.Payload)
}
func (o *GetContainerEndpointsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,110 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewListAllParams creates a new ListAllParams object
// with the default values initialized.
func NewListAllParams() *ListAllParams {
return &ListAllParams{
timeout: cr.DefaultTimeout,
}
}
// NewListAllParamsWithTimeout creates a new ListAllParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewListAllParamsWithTimeout(timeout time.Duration) *ListAllParams {
return &ListAllParams{
timeout: timeout,
}
}
// NewListAllParamsWithContext creates a new ListAllParams object
// with the default values initialized, and the ability to set a context for a request
func NewListAllParamsWithContext(ctx context.Context) *ListAllParams {
return &ListAllParams{
Context: ctx,
}
}
// NewListAllParamsWithHTTPClient creates a new ListAllParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewListAllParamsWithHTTPClient(client *http.Client) *ListAllParams {
return &ListAllParams{
HTTPClient: client,
}
}
/*ListAllParams contains all the parameters to send to the API endpoint
for the list all operation typically these are written to a http.Request
*/
type ListAllParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the list all params
func (o *ListAllParams) WithTimeout(timeout time.Duration) *ListAllParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list all params
func (o *ListAllParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list all params
func (o *ListAllParams) WithContext(ctx context.Context) *ListAllParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list all params
func (o *ListAllParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list all params
func (o *ListAllParams) WithHTTPClient(client *http.Client) *ListAllParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list all params
func (o *ListAllParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *ListAllParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,108 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ListAllReader is a Reader for the ListAll structure.
type ListAllReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListAllReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListAllOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewListAllDefault(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
}
}
// NewListAllOK creates a ListAllOK with default headers values
func NewListAllOK() *ListAllOK {
return &ListAllOK{}
}
/*ListAllOK handles this case with default header values.
OK
*/
type ListAllOK struct {
Payload []*models.ScopeConfig
}
func (o *ListAllOK) Error() string {
return fmt.Sprintf("[GET /scopes][%d] listAllOK %+v", 200, o.Payload)
}
func (o *ListAllOK) 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
}
// NewListAllDefault creates a ListAllDefault with default headers values
func NewListAllDefault(code int) *ListAllDefault {
return &ListAllDefault{
_statusCode: code,
}
}
/*ListAllDefault handles this case with default header values.
error
*/
type ListAllDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the list all default response
func (o *ListAllDefault) Code() int {
return o._statusCode
}
func (o *ListAllDefault) Error() string {
return fmt.Sprintf("[GET /scopes][%d] ListAll default %+v", o._statusCode, o.Payload)
}
func (o *ListAllDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewListParams creates a new ListParams object
// with the default values initialized.
func NewListParams() *ListParams {
var ()
return &ListParams{
timeout: cr.DefaultTimeout,
}
}
// NewListParamsWithTimeout creates a new ListParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewListParamsWithTimeout(timeout time.Duration) *ListParams {
var ()
return &ListParams{
timeout: timeout,
}
}
// NewListParamsWithContext creates a new ListParams object
// with the default values initialized, and the ability to set a context for a request
func NewListParamsWithContext(ctx context.Context) *ListParams {
var ()
return &ListParams{
Context: ctx,
}
}
// NewListParamsWithHTTPClient creates a new ListParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewListParamsWithHTTPClient(client *http.Client) *ListParams {
var ()
return &ListParams{
HTTPClient: client,
}
}
/*ListParams contains all the parameters to send to the API endpoint
for the list operation typically these are written to a http.Request
*/
type ListParams struct {
/*IDName*/
IDName string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the list params
func (o *ListParams) WithTimeout(timeout time.Duration) *ListParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list params
func (o *ListParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list params
func (o *ListParams) WithContext(ctx context.Context) *ListParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list params
func (o *ListParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list params
func (o *ListParams) WithHTTPClient(client *http.Client) *ListParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list params
func (o *ListParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithIDName adds the iDName to the list params
func (o *ListParams) WithIDName(iDName string) *ListParams {
o.SetIDName(iDName)
return o
}
// SetIDName adds the idName to the list params
func (o *ListParams) SetIDName(iDName string) {
o.IDName = iDName
}
// WriteToRequest writes these params to a swagger request
func (o *ListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param idName
if err := r.SetPathParam("idName", o.IDName); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,144 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// ListReader is a Reader for the List structure.
type ListReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewListNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewListDefault(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
}
}
// NewListOK creates a ListOK with default headers values
func NewListOK() *ListOK {
return &ListOK{}
}
/*ListOK handles this case with default header values.
OK
*/
type ListOK struct {
Payload []*models.ScopeConfig
}
func (o *ListOK) Error() string {
return fmt.Sprintf("[GET /scopes/{idName}][%d] listOK %+v", 200, o.Payload)
}
func (o *ListOK) 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
}
// NewListNotFound creates a ListNotFound with default headers values
func NewListNotFound() *ListNotFound {
return &ListNotFound{}
}
/*ListNotFound handles this case with default header values.
Not found
*/
type ListNotFound struct {
Payload *models.Error
}
func (o *ListNotFound) Error() string {
return fmt.Sprintf("[GET /scopes/{idName}][%d] listNotFound %+v", 404, o.Payload)
}
func (o *ListNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListDefault creates a ListDefault with default headers values
func NewListDefault(code int) *ListDefault {
return &ListDefault{
_statusCode: code,
}
}
/*ListDefault handles this case with default header values.
error
*/
type ListDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the list default response
func (o *ListDefault) Code() int {
return o._statusCode
}
func (o *ListDefault) Error() string {
return fmt.Sprintf("[GET /scopes/{idName}][%d] List default %+v", o._statusCode, o.Payload)
}
func (o *ListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,148 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewRemoveContainerParams creates a new RemoveContainerParams object
// with the default values initialized.
func NewRemoveContainerParams() *RemoveContainerParams {
var ()
return &RemoveContainerParams{
timeout: cr.DefaultTimeout,
}
}
// NewRemoveContainerParamsWithTimeout creates a new RemoveContainerParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewRemoveContainerParamsWithTimeout(timeout time.Duration) *RemoveContainerParams {
var ()
return &RemoveContainerParams{
timeout: timeout,
}
}
// NewRemoveContainerParamsWithContext creates a new RemoveContainerParams object
// with the default values initialized, and the ability to set a context for a request
func NewRemoveContainerParamsWithContext(ctx context.Context) *RemoveContainerParams {
var ()
return &RemoveContainerParams{
Context: ctx,
}
}
// NewRemoveContainerParamsWithHTTPClient creates a new RemoveContainerParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewRemoveContainerParamsWithHTTPClient(client *http.Client) *RemoveContainerParams {
var ()
return &RemoveContainerParams{
HTTPClient: client,
}
}
/*RemoveContainerParams contains all the parameters to send to the API endpoint
for the remove container operation typically these are written to a http.Request
*/
type RemoveContainerParams struct {
/*Handle*/
Handle string
/*Scope*/
Scope string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the remove container params
func (o *RemoveContainerParams) WithTimeout(timeout time.Duration) *RemoveContainerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the remove container params
func (o *RemoveContainerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the remove container params
func (o *RemoveContainerParams) WithContext(ctx context.Context) *RemoveContainerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the remove container params
func (o *RemoveContainerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the remove container params
func (o *RemoveContainerParams) WithHTTPClient(client *http.Client) *RemoveContainerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the remove container params
func (o *RemoveContainerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the remove container params
func (o *RemoveContainerParams) WithHandle(handle string) *RemoveContainerParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the remove container params
func (o *RemoveContainerParams) SetHandle(handle string) {
o.Handle = handle
}
// WithScope adds the scope to the remove container params
func (o *RemoveContainerParams) WithScope(scope string) *RemoveContainerParams {
o.SetScope(scope)
return o
}
// SetScope adds the scope to the remove container params
func (o *RemoveContainerParams) SetScope(scope string) {
o.Scope = scope
}
// WriteToRequest writes these params to a swagger request
func (o *RemoveContainerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
// path param scope
if err := r.SetPathParam("scope", o.Scope); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// RemoveContainerReader is a Reader for the RemoveContainer structure.
type RemoveContainerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RemoveContainerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRemoveContainerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewRemoveContainerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewRemoveContainerInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewRemoveContainerOK creates a RemoveContainerOK with default headers values
func NewRemoveContainerOK() *RemoveContainerOK {
return &RemoveContainerOK{}
}
/*RemoveContainerOK handles this case with default header values.
OK
*/
type RemoveContainerOK struct {
Payload string
}
func (o *RemoveContainerOK) Error() string {
return fmt.Sprintf("[DELETE /scopes/{scope}/containers/{handle}][%d] removeContainerOK %+v", 200, o.Payload)
}
func (o *RemoveContainerOK) 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
}
// NewRemoveContainerNotFound creates a RemoveContainerNotFound with default headers values
func NewRemoveContainerNotFound() *RemoveContainerNotFound {
return &RemoveContainerNotFound{}
}
/*RemoveContainerNotFound handles this case with default header values.
Not found
*/
type RemoveContainerNotFound struct {
Payload *models.Error
}
func (o *RemoveContainerNotFound) Error() string {
return fmt.Sprintf("[DELETE /scopes/{scope}/containers/{handle}][%d] removeContainerNotFound %+v", 404, o.Payload)
}
func (o *RemoveContainerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewRemoveContainerInternalServerError creates a RemoveContainerInternalServerError with default headers values
func NewRemoveContainerInternalServerError() *RemoveContainerInternalServerError {
return &RemoveContainerInternalServerError{}
}
/*RemoveContainerInternalServerError handles this case with default header values.
error
*/
type RemoveContainerInternalServerError struct {
Payload *models.Error
}
func (o *RemoveContainerInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /scopes/{scope}/containers/{handle}][%d] removeContainerInternalServerError %+v", 500, o.Payload)
}
func (o *RemoveContainerInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,280 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new scopes API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for scopes API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
AddContainer Add a container to scopes modifying the container VM's config as necessary
*/
func (a *Client) AddContainer(params *AddContainerParams) (*AddContainerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAddContainerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "AddContainer",
Method: "POST",
PathPattern: "/scopes/{scope}/containers",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &AddContainerReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*AddContainerOK), nil
}
/*
BindContainer Perform scope initialization for each of the scopes the container belongs to. Network initialization may include, for example, assigning addresses on a scope.
*/
func (a *Client) BindContainer(params *BindContainerParams) (*BindContainerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewBindContainerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "BindContainer",
Method: "POST",
PathPattern: "/scopes/containers/{handle}/binding",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &BindContainerReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*BindContainerOK), nil
}
/*
CreateScope creates a new scope
*/
func (a *Client) CreateScope(params *CreateScopeParams) (*CreateScopeCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateScopeParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "CreateScope",
Method: "POST",
PathPattern: "/scopes",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateScopeReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*CreateScopeCreated), nil
}
/*
DeleteScope delete scope API
*/
func (a *Client) DeleteScope(params *DeleteScopeParams) (*DeleteScopeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteScopeParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteScope",
Method: "DELETE",
PathPattern: "/scopes/{idName}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteScopeReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteScopeOK), nil
}
/*
GetContainerEndpoints Get a list of the endpoints for a container
*/
func (a *Client) GetContainerEndpoints(params *GetContainerEndpointsParams) (*GetContainerEndpointsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetContainerEndpointsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetContainerEndpoints",
Method: "GET",
PathPattern: "/scopes/containers/{handleOrId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &GetContainerEndpointsReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetContainerEndpointsOK), nil
}
/*
List list API
*/
func (a *Client) List(params *ListParams) (*ListOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "List",
Method: "GET",
PathPattern: "/scopes/{idName}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ListOK), nil
}
/*
ListAll list all API
*/
func (a *Client) ListAll(params *ListAllParams) (*ListAllOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListAllParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "ListAll",
Method: "GET",
PathPattern: "/scopes",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListAllReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ListAllOK), nil
}
/*
RemoveContainer Remove a container from a scope
*/
func (a *Client) RemoveContainer(params *RemoveContainerParams) (*RemoveContainerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRemoveContainerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "RemoveContainer",
Method: "DELETE",
PathPattern: "/scopes/{scope}/containers/{handle}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &RemoveContainerReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*RemoveContainerOK), nil
}
/*
UnbindContainer unbind container API
*/
func (a *Client) UnbindContainer(params *UnbindContainerParams) (*UnbindContainerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUnbindContainerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "UnbindContainer",
Method: "DELETE",
PathPattern: "/scopes/containers/{handle}/binding",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/octet-stream"},
Schemes: []string{"http"},
Params: params,
Reader: &UnbindContainerReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*UnbindContainerOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,130 @@
package scopes
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewUnbindContainerParams creates a new UnbindContainerParams object
// with the default values initialized.
func NewUnbindContainerParams() *UnbindContainerParams {
var ()
return &UnbindContainerParams{
timeout: cr.DefaultTimeout,
}
}
// NewUnbindContainerParamsWithTimeout creates a new UnbindContainerParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewUnbindContainerParamsWithTimeout(timeout time.Duration) *UnbindContainerParams {
var ()
return &UnbindContainerParams{
timeout: timeout,
}
}
// NewUnbindContainerParamsWithContext creates a new UnbindContainerParams object
// with the default values initialized, and the ability to set a context for a request
func NewUnbindContainerParamsWithContext(ctx context.Context) *UnbindContainerParams {
var ()
return &UnbindContainerParams{
Context: ctx,
}
}
// NewUnbindContainerParamsWithHTTPClient creates a new UnbindContainerParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewUnbindContainerParamsWithHTTPClient(client *http.Client) *UnbindContainerParams {
var ()
return &UnbindContainerParams{
HTTPClient: client,
}
}
/*UnbindContainerParams contains all the parameters to send to the API endpoint
for the unbind container operation typically these are written to a http.Request
*/
type UnbindContainerParams struct {
/*Handle*/
Handle string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the unbind container params
func (o *UnbindContainerParams) WithTimeout(timeout time.Duration) *UnbindContainerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the unbind container params
func (o *UnbindContainerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the unbind container params
func (o *UnbindContainerParams) WithContext(ctx context.Context) *UnbindContainerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the unbind container params
func (o *UnbindContainerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the unbind container params
func (o *UnbindContainerParams) WithHTTPClient(client *http.Client) *UnbindContainerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the unbind container params
func (o *UnbindContainerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithHandle adds the handle to the unbind container params
func (o *UnbindContainerParams) WithHandle(handle string) *UnbindContainerParams {
o.SetHandle(handle)
return o
}
// SetHandle adds the handle to the unbind container params
func (o *UnbindContainerParams) SetHandle(handle string) {
o.Handle = handle
}
// WriteToRequest writes these params to a swagger request
func (o *UnbindContainerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param handle
if err := r.SetPathParam("handle", o.Handle); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,137 @@
package scopes
// 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"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// UnbindContainerReader is a Reader for the UnbindContainer structure.
type UnbindContainerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *UnbindContainerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewUnbindContainerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewUnbindContainerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewUnbindContainerInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewUnbindContainerOK creates a UnbindContainerOK with default headers values
func NewUnbindContainerOK() *UnbindContainerOK {
return &UnbindContainerOK{}
}
/*UnbindContainerOK handles this case with default header values.
OK
*/
type UnbindContainerOK struct {
Payload *models.UnbindContainerResponse
}
func (o *UnbindContainerOK) Error() string {
return fmt.Sprintf("[DELETE /scopes/containers/{handle}/binding][%d] unbindContainerOK %+v", 200, o.Payload)
}
func (o *UnbindContainerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.UnbindContainerResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewUnbindContainerNotFound creates a UnbindContainerNotFound with default headers values
func NewUnbindContainerNotFound() *UnbindContainerNotFound {
return &UnbindContainerNotFound{}
}
/*UnbindContainerNotFound handles this case with default header values.
Not found
*/
type UnbindContainerNotFound struct {
Payload *models.Error
}
func (o *UnbindContainerNotFound) Error() string {
return fmt.Sprintf("[DELETE /scopes/containers/{handle}/binding][%d] unbindContainerNotFound %+v", 404, o.Payload)
}
func (o *UnbindContainerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewUnbindContainerInternalServerError creates a UnbindContainerInternalServerError with default headers values
func NewUnbindContainerInternalServerError() *UnbindContainerInternalServerError {
return &UnbindContainerInternalServerError{}
}
/*UnbindContainerInternalServerError handles this case with default header values.
error
*/
type UnbindContainerInternalServerError struct {
Payload *models.Error
}
func (o *UnbindContainerInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /scopes/containers/{handle}/binding][%d] unbindContainerInternalServerError %+v", 500, o.Payload)
}
func (o *UnbindContainerInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewCreateImageStoreParams creates a new CreateImageStoreParams object
// with the default values initialized.
func NewCreateImageStoreParams() *CreateImageStoreParams {
var ()
return &CreateImageStoreParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateImageStoreParamsWithTimeout creates a new CreateImageStoreParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCreateImageStoreParamsWithTimeout(timeout time.Duration) *CreateImageStoreParams {
var ()
return &CreateImageStoreParams{
timeout: timeout,
}
}
// NewCreateImageStoreParamsWithContext creates a new CreateImageStoreParams object
// with the default values initialized, and the ability to set a context for a request
func NewCreateImageStoreParamsWithContext(ctx context.Context) *CreateImageStoreParams {
var ()
return &CreateImageStoreParams{
Context: ctx,
}
}
// NewCreateImageStoreParamsWithHTTPClient creates a new CreateImageStoreParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCreateImageStoreParamsWithHTTPClient(client *http.Client) *CreateImageStoreParams {
var ()
return &CreateImageStoreParams{
HTTPClient: client,
}
}
/*CreateImageStoreParams contains all the parameters to send to the API endpoint
for the create image store operation typically these are written to a http.Request
*/
type CreateImageStoreParams struct {
/*Body*/
Body *models.ImageStore
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the create image store params
func (o *CreateImageStoreParams) WithTimeout(timeout time.Duration) *CreateImageStoreParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create image store params
func (o *CreateImageStoreParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create image store params
func (o *CreateImageStoreParams) WithContext(ctx context.Context) *CreateImageStoreParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create image store params
func (o *CreateImageStoreParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create image store params
func (o *CreateImageStoreParams) WithHTTPClient(client *http.Client) *CreateImageStoreParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create image store params
func (o *CreateImageStoreParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the create image store params
func (o *CreateImageStoreParams) WithBody(body *models.ImageStore) *CreateImageStoreParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the create image store params
func (o *CreateImageStoreParams) SetBody(body *models.ImageStore) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *CreateImageStoreParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Body == nil {
o.Body = new(models.ImageStore)
}
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,146 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// CreateImageStoreReader is a Reader for the CreateImageStore structure.
type CreateImageStoreReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateImageStoreReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewCreateImageStoreCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 409:
result := NewCreateImageStoreConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewCreateImageStoreDefault(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
}
}
// NewCreateImageStoreCreated creates a CreateImageStoreCreated with default headers values
func NewCreateImageStoreCreated() *CreateImageStoreCreated {
return &CreateImageStoreCreated{}
}
/*CreateImageStoreCreated handles this case with default header values.
Created
*/
type CreateImageStoreCreated struct {
Payload *models.StoreURL
}
func (o *CreateImageStoreCreated) Error() string {
return fmt.Sprintf("[POST /storage][%d] createImageStoreCreated %+v", 201, o.Payload)
}
func (o *CreateImageStoreCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.StoreURL)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateImageStoreConflict creates a CreateImageStoreConflict with default headers values
func NewCreateImageStoreConflict() *CreateImageStoreConflict {
return &CreateImageStoreConflict{}
}
/*CreateImageStoreConflict handles this case with default header values.
An image store with that name already exists.
*/
type CreateImageStoreConflict struct {
Payload *models.Error
}
func (o *CreateImageStoreConflict) Error() string {
return fmt.Sprintf("[POST /storage][%d] createImageStoreConflict %+v", 409, o.Payload)
}
func (o *CreateImageStoreConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateImageStoreDefault creates a CreateImageStoreDefault with default headers values
func NewCreateImageStoreDefault(code int) *CreateImageStoreDefault {
return &CreateImageStoreDefault{
_statusCode: code,
}
}
/*CreateImageStoreDefault handles this case with default header values.
error
*/
type CreateImageStoreDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the create image store default response
func (o *CreateImageStoreDefault) Code() int {
return o._statusCode
}
func (o *CreateImageStoreDefault) Error() string {
return fmt.Sprintf("[POST /storage][%d] CreateImageStore default %+v", o._statusCode, o.Payload)
}
func (o *CreateImageStoreDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,135 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// NewCreateVolumeParams creates a new CreateVolumeParams object
// with the default values initialized.
func NewCreateVolumeParams() *CreateVolumeParams {
var ()
return &CreateVolumeParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateVolumeParamsWithTimeout creates a new CreateVolumeParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCreateVolumeParamsWithTimeout(timeout time.Duration) *CreateVolumeParams {
var ()
return &CreateVolumeParams{
timeout: timeout,
}
}
// NewCreateVolumeParamsWithContext creates a new CreateVolumeParams object
// with the default values initialized, and the ability to set a context for a request
func NewCreateVolumeParamsWithContext(ctx context.Context) *CreateVolumeParams {
var ()
return &CreateVolumeParams{
Context: ctx,
}
}
// NewCreateVolumeParamsWithHTTPClient creates a new CreateVolumeParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCreateVolumeParamsWithHTTPClient(client *http.Client) *CreateVolumeParams {
var ()
return &CreateVolumeParams{
HTTPClient: client,
}
}
/*CreateVolumeParams contains all the parameters to send to the API endpoint
for the create volume operation typically these are written to a http.Request
*/
type CreateVolumeParams struct {
/*VolumeRequest*/
VolumeRequest *models.VolumeRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the create volume params
func (o *CreateVolumeParams) WithTimeout(timeout time.Duration) *CreateVolumeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create volume params
func (o *CreateVolumeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create volume params
func (o *CreateVolumeParams) WithContext(ctx context.Context) *CreateVolumeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create volume params
func (o *CreateVolumeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create volume params
func (o *CreateVolumeParams) WithHTTPClient(client *http.Client) *CreateVolumeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create volume params
func (o *CreateVolumeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithVolumeRequest adds the volumeRequest to the create volume params
func (o *CreateVolumeParams) WithVolumeRequest(volumeRequest *models.VolumeRequest) *CreateVolumeParams {
o.SetVolumeRequest(volumeRequest)
return o
}
// SetVolumeRequest adds the volumeRequest to the create volume params
func (o *CreateVolumeParams) SetVolumeRequest(volumeRequest *models.VolumeRequest) {
o.VolumeRequest = volumeRequest
}
// WriteToRequest writes these params to a swagger request
func (o *CreateVolumeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.VolumeRequest == nil {
o.VolumeRequest = new(models.VolumeRequest)
}
if err := r.SetBodyParam(o.VolumeRequest); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,218 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// CreateVolumeReader is a Reader for the CreateVolume structure.
type CreateVolumeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateVolumeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewCreateVolumeCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewCreateVolumeNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewCreateVolumeConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewCreateVolumeInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewCreateVolumeDefault(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
}
}
// NewCreateVolumeCreated creates a CreateVolumeCreated with default headers values
func NewCreateVolumeCreated() *CreateVolumeCreated {
return &CreateVolumeCreated{}
}
/*CreateVolumeCreated handles this case with default header values.
Created
*/
type CreateVolumeCreated struct {
Payload *models.VolumeResponse
}
func (o *CreateVolumeCreated) Error() string {
return fmt.Sprintf("[POST /storage/volumes][%d] createVolumeCreated %+v", 201, o.Payload)
}
func (o *CreateVolumeCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.VolumeResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateVolumeNotFound creates a CreateVolumeNotFound with default headers values
func NewCreateVolumeNotFound() *CreateVolumeNotFound {
return &CreateVolumeNotFound{}
}
/*CreateVolumeNotFound handles this case with default header values.
VolumeStore Does not Exist
*/
type CreateVolumeNotFound struct {
Payload *models.Error
}
func (o *CreateVolumeNotFound) Error() string {
return fmt.Sprintf("[POST /storage/volumes][%d] createVolumeNotFound %+v", 404, o.Payload)
}
func (o *CreateVolumeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateVolumeConflict creates a CreateVolumeConflict with default headers values
func NewCreateVolumeConflict() *CreateVolumeConflict {
return &CreateVolumeConflict{}
}
/*CreateVolumeConflict handles this case with default header values.
Volume already exists by that ID
*/
type CreateVolumeConflict struct {
Payload *models.Error
}
func (o *CreateVolumeConflict) Error() string {
return fmt.Sprintf("[POST /storage/volumes][%d] createVolumeConflict %+v", 409, o.Payload)
}
func (o *CreateVolumeConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateVolumeInternalServerError creates a CreateVolumeInternalServerError with default headers values
func NewCreateVolumeInternalServerError() *CreateVolumeInternalServerError {
return &CreateVolumeInternalServerError{}
}
/*CreateVolumeInternalServerError handles this case with default header values.
Error
*/
type CreateVolumeInternalServerError struct {
Payload *models.Error
}
func (o *CreateVolumeInternalServerError) Error() string {
return fmt.Sprintf("[POST /storage/volumes][%d] createVolumeInternalServerError %+v", 500, o.Payload)
}
func (o *CreateVolumeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateVolumeDefault creates a CreateVolumeDefault with default headers values
func NewCreateVolumeDefault(code int) *CreateVolumeDefault {
return &CreateVolumeDefault{
_statusCode: code,
}
}
/*CreateVolumeDefault handles this case with default header values.
error
*/
type CreateVolumeDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the create volume default response
func (o *CreateVolumeDefault) Code() int {
return o._statusCode
}
func (o *CreateVolumeDefault) Error() string {
return fmt.Sprintf("[POST /storage/volumes][%d] CreateVolume default %+v", o._statusCode, o.Payload)
}
func (o *CreateVolumeDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,170 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteImageParams creates a new DeleteImageParams object
// with the default values initialized.
func NewDeleteImageParams() *DeleteImageParams {
var ()
return &DeleteImageParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteImageParamsWithTimeout creates a new DeleteImageParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteImageParamsWithTimeout(timeout time.Duration) *DeleteImageParams {
var ()
return &DeleteImageParams{
timeout: timeout,
}
}
// NewDeleteImageParamsWithContext creates a new DeleteImageParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteImageParamsWithContext(ctx context.Context) *DeleteImageParams {
var ()
return &DeleteImageParams{
Context: ctx,
}
}
// NewDeleteImageParamsWithHTTPClient creates a new DeleteImageParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteImageParamsWithHTTPClient(client *http.Client) *DeleteImageParams {
var ()
return &DeleteImageParams{
HTTPClient: client,
}
}
/*DeleteImageParams contains all the parameters to send to the API endpoint
for the delete image operation typically these are written to a http.Request
*/
type DeleteImageParams struct {
/*ID*/
ID string
/*KeepNodes*/
KeepNodes []string
/*StoreName*/
StoreName string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete image params
func (o *DeleteImageParams) WithTimeout(timeout time.Duration) *DeleteImageParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete image params
func (o *DeleteImageParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete image params
func (o *DeleteImageParams) WithContext(ctx context.Context) *DeleteImageParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete image params
func (o *DeleteImageParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete image params
func (o *DeleteImageParams) WithHTTPClient(client *http.Client) *DeleteImageParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete image params
func (o *DeleteImageParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the delete image params
func (o *DeleteImageParams) WithID(id string) *DeleteImageParams {
o.SetID(id)
return o
}
// SetID adds the id to the delete image params
func (o *DeleteImageParams) SetID(id string) {
o.ID = id
}
// WithKeepNodes adds the keepNodes to the delete image params
func (o *DeleteImageParams) WithKeepNodes(keepNodes []string) *DeleteImageParams {
o.SetKeepNodes(keepNodes)
return o
}
// SetKeepNodes adds the keepNodes to the delete image params
func (o *DeleteImageParams) SetKeepNodes(keepNodes []string) {
o.KeepNodes = keepNodes
}
// WithStoreName adds the storeName to the delete image params
func (o *DeleteImageParams) WithStoreName(storeName string) *DeleteImageParams {
o.SetStoreName(storeName)
return o
}
// SetStoreName adds the storeName to the delete image params
func (o *DeleteImageParams) SetStoreName(storeName string) {
o.StoreName = storeName
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteImageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
valuesKeepNodes := o.KeepNodes
joinedKeepNodes := swag.JoinByFormat(valuesKeepNodes, "")
// query array param keepNodes
if err := r.SetQueryParam("keepNodes", joinedKeepNodes...); err != nil {
return err
}
// path param store_name
if err := r.SetPathParam("store_name", o.StoreName); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,180 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// DeleteImageReader is a Reader for the DeleteImage structure.
type DeleteImageReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteImageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteImageOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteImageNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 423:
result := NewDeleteImageLocked()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewDeleteImageDefault(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
}
}
// NewDeleteImageOK creates a DeleteImageOK with default headers values
func NewDeleteImageOK() *DeleteImageOK {
return &DeleteImageOK{}
}
/*DeleteImageOK handles this case with default header values.
OK
*/
type DeleteImageOK struct {
Payload []*models.Image
}
func (o *DeleteImageOK) Error() string {
return fmt.Sprintf("[DELETE /storage/{store_name}/info/{id}][%d] deleteImageOK %+v", 200, o.Payload)
}
func (o *DeleteImageOK) 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
}
// NewDeleteImageNotFound creates a DeleteImageNotFound with default headers values
func NewDeleteImageNotFound() *DeleteImageNotFound {
return &DeleteImageNotFound{}
}
/*DeleteImageNotFound handles this case with default header values.
Not found
*/
type DeleteImageNotFound struct {
Payload *models.Error
}
func (o *DeleteImageNotFound) Error() string {
return fmt.Sprintf("[DELETE /storage/{store_name}/info/{id}][%d] deleteImageNotFound %+v", 404, o.Payload)
}
func (o *DeleteImageNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewDeleteImageLocked creates a DeleteImageLocked with default headers values
func NewDeleteImageLocked() *DeleteImageLocked {
return &DeleteImageLocked{}
}
/*DeleteImageLocked handles this case with default header values.
In use
*/
type DeleteImageLocked struct {
Payload *models.Error
}
func (o *DeleteImageLocked) Error() string {
return fmt.Sprintf("[DELETE /storage/{store_name}/info/{id}][%d] deleteImageLocked %+v", 423, o.Payload)
}
func (o *DeleteImageLocked) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewDeleteImageDefault creates a DeleteImageDefault with default headers values
func NewDeleteImageDefault(code int) *DeleteImageDefault {
return &DeleteImageDefault{
_statusCode: code,
}
}
/*DeleteImageDefault handles this case with default header values.
error
*/
type DeleteImageDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the delete image default response
func (o *DeleteImageDefault) Code() int {
return o._statusCode
}
func (o *DeleteImageDefault) Error() string {
return fmt.Sprintf("[DELETE /storage/{store_name}/info/{id}][%d] DeleteImage default %+v", o._statusCode, o.Payload)
}
func (o *DeleteImageDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,266 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewExportArchiveParams creates a new ExportArchiveParams object
// with the default values initialized.
func NewExportArchiveParams() *ExportArchiveParams {
var ()
return &ExportArchiveParams{
timeout: cr.DefaultTimeout,
}
}
// NewExportArchiveParamsWithTimeout creates a new ExportArchiveParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewExportArchiveParamsWithTimeout(timeout time.Duration) *ExportArchiveParams {
var ()
return &ExportArchiveParams{
timeout: timeout,
}
}
// NewExportArchiveParamsWithContext creates a new ExportArchiveParams object
// with the default values initialized, and the ability to set a context for a request
func NewExportArchiveParamsWithContext(ctx context.Context) *ExportArchiveParams {
var ()
return &ExportArchiveParams{
Context: ctx,
}
}
// NewExportArchiveParamsWithHTTPClient creates a new ExportArchiveParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewExportArchiveParamsWithHTTPClient(client *http.Client) *ExportArchiveParams {
var ()
return &ExportArchiveParams{
HTTPClient: client,
}
}
/*ExportArchiveParams contains all the parameters to send to the API endpoint
for the export archive operation typically these are written to a http.Request
*/
type ExportArchiveParams struct {
/*Ancestor*/
Ancestor *string
/*AncestorStore*/
AncestorStore *string
/*Data*/
Data bool
/*DeviceID*/
DeviceID string
/*FilterSpec*/
FilterSpec *string
/*Store*/
Store string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the export archive params
func (o *ExportArchiveParams) WithTimeout(timeout time.Duration) *ExportArchiveParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the export archive params
func (o *ExportArchiveParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the export archive params
func (o *ExportArchiveParams) WithContext(ctx context.Context) *ExportArchiveParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the export archive params
func (o *ExportArchiveParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the export archive params
func (o *ExportArchiveParams) WithHTTPClient(client *http.Client) *ExportArchiveParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the export archive params
func (o *ExportArchiveParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAncestor adds the ancestor to the export archive params
func (o *ExportArchiveParams) WithAncestor(ancestor *string) *ExportArchiveParams {
o.SetAncestor(ancestor)
return o
}
// SetAncestor adds the ancestor to the export archive params
func (o *ExportArchiveParams) SetAncestor(ancestor *string) {
o.Ancestor = ancestor
}
// WithAncestorStore adds the ancestorStore to the export archive params
func (o *ExportArchiveParams) WithAncestorStore(ancestorStore *string) *ExportArchiveParams {
o.SetAncestorStore(ancestorStore)
return o
}
// SetAncestorStore adds the ancestorStore to the export archive params
func (o *ExportArchiveParams) SetAncestorStore(ancestorStore *string) {
o.AncestorStore = ancestorStore
}
// WithData adds the data to the export archive params
func (o *ExportArchiveParams) WithData(data bool) *ExportArchiveParams {
o.SetData(data)
return o
}
// SetData adds the data to the export archive params
func (o *ExportArchiveParams) SetData(data bool) {
o.Data = data
}
// WithDeviceID adds the deviceID to the export archive params
func (o *ExportArchiveParams) WithDeviceID(deviceID string) *ExportArchiveParams {
o.SetDeviceID(deviceID)
return o
}
// SetDeviceID adds the deviceId to the export archive params
func (o *ExportArchiveParams) SetDeviceID(deviceID string) {
o.DeviceID = deviceID
}
// WithFilterSpec adds the filterSpec to the export archive params
func (o *ExportArchiveParams) WithFilterSpec(filterSpec *string) *ExportArchiveParams {
o.SetFilterSpec(filterSpec)
return o
}
// SetFilterSpec adds the filterSpec to the export archive params
func (o *ExportArchiveParams) SetFilterSpec(filterSpec *string) {
o.FilterSpec = filterSpec
}
// WithStore adds the store to the export archive params
func (o *ExportArchiveParams) WithStore(store string) *ExportArchiveParams {
o.SetStore(store)
return o
}
// SetStore adds the store to the export archive params
func (o *ExportArchiveParams) SetStore(store string) {
o.Store = store
}
// WriteToRequest writes these params to a swagger request
func (o *ExportArchiveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.Ancestor != nil {
// query param ancestor
var qrAncestor string
if o.Ancestor != nil {
qrAncestor = *o.Ancestor
}
qAncestor := qrAncestor
if qAncestor != "" {
if err := r.SetQueryParam("ancestor", qAncestor); err != nil {
return err
}
}
}
if o.AncestorStore != nil {
// query param ancestorStore
var qrAncestorStore string
if o.AncestorStore != nil {
qrAncestorStore = *o.AncestorStore
}
qAncestorStore := qrAncestorStore
if qAncestorStore != "" {
if err := r.SetQueryParam("ancestorStore", qAncestorStore); err != nil {
return err
}
}
}
// query param data
qrData := o.Data
qData := swag.FormatBool(qrData)
if qData != "" {
if err := r.SetQueryParam("data", qData); err != nil {
return err
}
}
// query param deviceID
qrDeviceID := o.DeviceID
qDeviceID := qrDeviceID
if qDeviceID != "" {
if err := r.SetQueryParam("deviceID", qDeviceID); err != nil {
return err
}
}
if o.FilterSpec != nil {
// query param filterSpec
var qrFilterSpec string
if o.FilterSpec != nil {
qrFilterSpec = *o.FilterSpec
}
qFilterSpec := qrFilterSpec
if qFilterSpec != "" {
if err := r.SetQueryParam("filterSpec", qFilterSpec); err != nil {
return err
}
}
}
// query param store
qrStore := o.Store
qStore := qrStore
if qStore != "" {
if err := r.SetQueryParam("store", qStore); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,212 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// ExportArchiveReader is a Reader for the ExportArchive structure.
type ExportArchiveReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *ExportArchiveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewExportArchiveOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewExportArchiveNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewExportArchiveUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 423:
result := NewExportArchiveLocked()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewExportArchiveInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewExportArchiveDefault(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
}
}
// NewExportArchiveOK creates a ExportArchiveOK with default headers values
func NewExportArchiveOK(writer io.Writer) *ExportArchiveOK {
return &ExportArchiveOK{
Payload: writer,
}
}
/*ExportArchiveOK handles this case with default header values.
OK
*/
type ExportArchiveOK struct {
Payload io.Writer
}
func (o *ExportArchiveOK) Error() string {
return fmt.Sprintf("[GET /archive][%d] exportArchiveOK %+v", 200, o.Payload)
}
func (o *ExportArchiveOK) 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
}
// NewExportArchiveNotFound creates a ExportArchiveNotFound with default headers values
func NewExportArchiveNotFound() *ExportArchiveNotFound {
return &ExportArchiveNotFound{}
}
/*ExportArchiveNotFound handles this case with default header values.
Supplied target not found
*/
type ExportArchiveNotFound struct {
}
func (o *ExportArchiveNotFound) Error() string {
return fmt.Sprintf("[GET /archive][%d] exportArchiveNotFound ", 404)
}
func (o *ExportArchiveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewExportArchiveUnprocessableEntity creates a ExportArchiveUnprocessableEntity with default headers values
func NewExportArchiveUnprocessableEntity() *ExportArchiveUnprocessableEntity {
return &ExportArchiveUnprocessableEntity{}
}
/*ExportArchiveUnprocessableEntity handles this case with default header values.
Format error in supplied filter or archive
*/
type ExportArchiveUnprocessableEntity struct {
}
func (o *ExportArchiveUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /archive][%d] exportArchiveUnprocessableEntity ", 422)
}
func (o *ExportArchiveUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewExportArchiveLocked creates a ExportArchiveLocked with default headers values
func NewExportArchiveLocked() *ExportArchiveLocked {
return &ExportArchiveLocked{}
}
/*ExportArchiveLocked handles this case with default header values.
Device or resource is locked
*/
type ExportArchiveLocked struct {
}
func (o *ExportArchiveLocked) Error() string {
return fmt.Sprintf("[GET /archive][%d] exportArchiveLocked ", 423)
}
func (o *ExportArchiveLocked) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewExportArchiveInternalServerError creates a ExportArchiveInternalServerError with default headers values
func NewExportArchiveInternalServerError() *ExportArchiveInternalServerError {
return &ExportArchiveInternalServerError{}
}
/*ExportArchiveInternalServerError handles this case with default header values.
failed to export tar archive from target
*/
type ExportArchiveInternalServerError struct {
}
func (o *ExportArchiveInternalServerError) Error() string {
return fmt.Sprintf("[GET /archive][%d] exportArchiveInternalServerError ", 500)
}
func (o *ExportArchiveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewExportArchiveDefault creates a ExportArchiveDefault with default headers values
func NewExportArchiveDefault(code int) *ExportArchiveDefault {
return &ExportArchiveDefault{
_statusCode: code,
}
}
/*ExportArchiveDefault handles this case with default header values.
error
*/
type ExportArchiveDefault struct {
_statusCode int
}
// Code gets the status code for the export archive default response
func (o *ExportArchiveDefault) Code() int {
return o._statusCode
}
func (o *ExportArchiveDefault) Error() string {
return fmt.Sprintf("[GET /archive][%d] ExportArchive default ", o._statusCode)
}
func (o *ExportArchiveDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,148 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetImageParams creates a new GetImageParams object
// with the default values initialized.
func NewGetImageParams() *GetImageParams {
var ()
return &GetImageParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetImageParamsWithTimeout creates a new GetImageParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetImageParamsWithTimeout(timeout time.Duration) *GetImageParams {
var ()
return &GetImageParams{
timeout: timeout,
}
}
// NewGetImageParamsWithContext creates a new GetImageParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetImageParamsWithContext(ctx context.Context) *GetImageParams {
var ()
return &GetImageParams{
Context: ctx,
}
}
// NewGetImageParamsWithHTTPClient creates a new GetImageParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetImageParamsWithHTTPClient(client *http.Client) *GetImageParams {
var ()
return &GetImageParams{
HTTPClient: client,
}
}
/*GetImageParams contains all the parameters to send to the API endpoint
for the get image operation typically these are written to a http.Request
*/
type GetImageParams struct {
/*ID*/
ID string
/*StoreName*/
StoreName string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get image params
func (o *GetImageParams) WithTimeout(timeout time.Duration) *GetImageParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get image params
func (o *GetImageParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get image params
func (o *GetImageParams) WithContext(ctx context.Context) *GetImageParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get image params
func (o *GetImageParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get image params
func (o *GetImageParams) WithHTTPClient(client *http.Client) *GetImageParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get image params
func (o *GetImageParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get image params
func (o *GetImageParams) WithID(id string) *GetImageParams {
o.SetID(id)
return o
}
// SetID adds the id to the get image params
func (o *GetImageParams) SetID(id string) {
o.ID = id
}
// WithStoreName adds the storeName to the get image params
func (o *GetImageParams) WithStoreName(storeName string) *GetImageParams {
o.SetStoreName(storeName)
return o
}
// SetStoreName adds the storeName to the get image params
func (o *GetImageParams) SetStoreName(storeName string) {
o.StoreName = storeName
}
// WriteToRequest writes these params to a swagger request
func (o *GetImageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// path param store_name
if err := r.SetPathParam("store_name", o.StoreName); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,146 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetImageReader is a Reader for the GetImage structure.
type GetImageReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetImageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetImageOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetImageNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetImageDefault(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
}
}
// NewGetImageOK creates a GetImageOK with default headers values
func NewGetImageOK() *GetImageOK {
return &GetImageOK{}
}
/*GetImageOK handles this case with default header values.
OK
*/
type GetImageOK struct {
Payload *models.Image
}
func (o *GetImageOK) Error() string {
return fmt.Sprintf("[GET /storage/{store_name}/info/{id}][%d] getImageOK %+v", 200, o.Payload)
}
func (o *GetImageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Image)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetImageNotFound creates a GetImageNotFound with default headers values
func NewGetImageNotFound() *GetImageNotFound {
return &GetImageNotFound{}
}
/*GetImageNotFound handles this case with default header values.
Not found
*/
type GetImageNotFound struct {
Payload *models.Error
}
func (o *GetImageNotFound) Error() string {
return fmt.Sprintf("[GET /storage/{store_name}/info/{id}][%d] getImageNotFound %+v", 404, o.Payload)
}
func (o *GetImageNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetImageDefault creates a GetImageDefault with default headers values
func NewGetImageDefault(code int) *GetImageDefault {
return &GetImageDefault{
_statusCode: code,
}
}
/*GetImageDefault handles this case with default header values.
error
*/
type GetImageDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get image default response
func (o *GetImageDefault) Code() int {
return o._statusCode
}
func (o *GetImageDefault) Error() string {
return fmt.Sprintf("[GET /storage/{store_name}/info/{id}][%d] GetImage default %+v", o._statusCode, o.Payload)
}
func (o *GetImageDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,148 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetImageTarParams creates a new GetImageTarParams object
// with the default values initialized.
func NewGetImageTarParams() *GetImageTarParams {
var ()
return &GetImageTarParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetImageTarParamsWithTimeout creates a new GetImageTarParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetImageTarParamsWithTimeout(timeout time.Duration) *GetImageTarParams {
var ()
return &GetImageTarParams{
timeout: timeout,
}
}
// NewGetImageTarParamsWithContext creates a new GetImageTarParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetImageTarParamsWithContext(ctx context.Context) *GetImageTarParams {
var ()
return &GetImageTarParams{
Context: ctx,
}
}
// NewGetImageTarParamsWithHTTPClient creates a new GetImageTarParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetImageTarParamsWithHTTPClient(client *http.Client) *GetImageTarParams {
var ()
return &GetImageTarParams{
HTTPClient: client,
}
}
/*GetImageTarParams contains all the parameters to send to the API endpoint
for the get image tar operation typically these are written to a http.Request
*/
type GetImageTarParams struct {
/*ID*/
ID string
/*StoreName*/
StoreName string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get image tar params
func (o *GetImageTarParams) WithTimeout(timeout time.Duration) *GetImageTarParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get image tar params
func (o *GetImageTarParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get image tar params
func (o *GetImageTarParams) WithContext(ctx context.Context) *GetImageTarParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get image tar params
func (o *GetImageTarParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get image tar params
func (o *GetImageTarParams) WithHTTPClient(client *http.Client) *GetImageTarParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get image tar params
func (o *GetImageTarParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get image tar params
func (o *GetImageTarParams) WithID(id string) *GetImageTarParams {
o.SetID(id)
return o
}
// SetID adds the id to the get image tar params
func (o *GetImageTarParams) SetID(id string) {
o.ID = id
}
// WithStoreName adds the storeName to the get image tar params
func (o *GetImageTarParams) WithStoreName(storeName string) *GetImageTarParams {
o.SetStoreName(storeName)
return o
}
// SetStoreName adds the storeName to the get image tar params
func (o *GetImageTarParams) SetStoreName(storeName string) {
o.StoreName = storeName
}
// WriteToRequest writes these params to a swagger request
func (o *GetImageTarParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// path param store_name
if err := r.SetPathParam("store_name", o.StoreName); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,139 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetImageTarReader is a Reader for the GetImageTar structure.
type GetImageTarReader struct {
formats strfmt.Registry
writer io.Writer
}
// ReadResponse reads a server response into the received o.
func (o *GetImageTarReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetImageTarOK(o.writer)
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetImageTarNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetImageTarDefault(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
}
}
// NewGetImageTarOK creates a GetImageTarOK with default headers values
func NewGetImageTarOK(writer io.Writer) *GetImageTarOK {
return &GetImageTarOK{
Payload: writer,
}
}
/*GetImageTarOK handles this case with default header values.
OK
*/
type GetImageTarOK struct {
Payload io.Writer
}
func (o *GetImageTarOK) Error() string {
return fmt.Sprintf("[GET /storage/{store_name}/tar/{id}][%d] getImageTarOK %+v", 200, o.Payload)
}
func (o *GetImageTarOK) 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
}
// NewGetImageTarNotFound creates a GetImageTarNotFound with default headers values
func NewGetImageTarNotFound() *GetImageTarNotFound {
return &GetImageTarNotFound{}
}
/*GetImageTarNotFound handles this case with default header values.
Not found
*/
type GetImageTarNotFound struct {
}
func (o *GetImageTarNotFound) Error() string {
return fmt.Sprintf("[GET /storage/{store_name}/tar/{id}][%d] getImageTarNotFound ", 404)
}
func (o *GetImageTarNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetImageTarDefault creates a GetImageTarDefault with default headers values
func NewGetImageTarDefault(code int) *GetImageTarDefault {
return &GetImageTarDefault{
_statusCode: code,
}
}
/*GetImageTarDefault handles this case with default header values.
error
*/
type GetImageTarDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get image tar default response
func (o *GetImageTarDefault) Code() int {
return o._statusCode
}
func (o *GetImageTarDefault) Error() string {
return fmt.Sprintf("[GET /storage/{store_name}/tar/{id}][%d] GetImageTar default %+v", o._statusCode, o.Payload)
}
func (o *GetImageTarDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,130 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetVolumeParams creates a new GetVolumeParams object
// with the default values initialized.
func NewGetVolumeParams() *GetVolumeParams {
var ()
return &GetVolumeParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetVolumeParamsWithTimeout creates a new GetVolumeParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetVolumeParamsWithTimeout(timeout time.Duration) *GetVolumeParams {
var ()
return &GetVolumeParams{
timeout: timeout,
}
}
// NewGetVolumeParamsWithContext creates a new GetVolumeParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetVolumeParamsWithContext(ctx context.Context) *GetVolumeParams {
var ()
return &GetVolumeParams{
Context: ctx,
}
}
// NewGetVolumeParamsWithHTTPClient creates a new GetVolumeParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetVolumeParamsWithHTTPClient(client *http.Client) *GetVolumeParams {
var ()
return &GetVolumeParams{
HTTPClient: client,
}
}
/*GetVolumeParams contains all the parameters to send to the API endpoint
for the get volume operation typically these are written to a http.Request
*/
type GetVolumeParams struct {
/*Name*/
Name string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get volume params
func (o *GetVolumeParams) WithTimeout(timeout time.Duration) *GetVolumeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get volume params
func (o *GetVolumeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get volume params
func (o *GetVolumeParams) WithContext(ctx context.Context) *GetVolumeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get volume params
func (o *GetVolumeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get volume params
func (o *GetVolumeParams) WithHTTPClient(client *http.Client) *GetVolumeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get volume params
func (o *GetVolumeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithName adds the name to the get volume params
func (o *GetVolumeParams) WithName(name string) *GetVolumeParams {
o.SetName(name)
return o
}
// SetName adds the name to the get volume params
func (o *GetVolumeParams) SetName(name string) {
o.Name = name
}
// WriteToRequest writes these params to a swagger request
func (o *GetVolumeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
// path param name
if err := r.SetPathParam("name", o.Name); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,101 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/vmware/vic/lib/apiservers/portlayer/models"
)
// GetVolumeReader is a Reader for the GetVolume structure.
type GetVolumeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetVolumeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetVolumeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetVolumeNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("unknown error", response, response.Code())
}
}
// NewGetVolumeOK creates a GetVolumeOK with default headers values
func NewGetVolumeOK() *GetVolumeOK {
return &GetVolumeOK{}
}
/*GetVolumeOK handles this case with default header values.
OK
*/
type GetVolumeOK struct {
Payload *models.VolumeResponse
}
func (o *GetVolumeOK) Error() string {
return fmt.Sprintf("[GET /storage/volumes/{name}][%d] getVolumeOK %+v", 200, o.Payload)
}
func (o *GetVolumeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.VolumeResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetVolumeNotFound creates a GetVolumeNotFound with default headers values
func NewGetVolumeNotFound() *GetVolumeNotFound {
return &GetVolumeNotFound{}
}
/*GetVolumeNotFound handles this case with default header values.
Volume not found
*/
type GetVolumeNotFound struct {
Payload *models.Error
}
func (o *GetVolumeNotFound) Error() string {
return fmt.Sprintf("[GET /storage/volumes/{name}][%d] getVolumeNotFound %+v", 404, o.Payload)
}
func (o *GetVolumeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More