Merge branch 'function_go-update' into 'master'

Updating functions_go to newer version

See merge request !81
This commit is contained in:
Travis Reeder
2017-06-27 12:02:35 -07:00
12 changed files with 794 additions and 125 deletions

5
fn/glide.lock generated
View File

@@ -1,5 +1,5 @@
hash: aac209bf551382f2b8637d3f771a7e94b9ec9749acad17f76f4406a1f4d4fefd hash: aac209bf551382f2b8637d3f771a7e94b9ec9749acad17f76f4406a1f4d4fefd
updated: 2017-06-11T02:02:29.974339349-07:00 updated: 2017-06-27T21:33:40.071148609+03:00
imports: imports:
- name: github.com/asaskevich/govalidator - name: github.com/asaskevich/govalidator
version: aa5cce4a76edb1a5acecab1870c17abbffb5419e version: aa5cce4a76edb1a5acecab1870c17abbffb5419e
@@ -50,11 +50,12 @@ imports:
- name: github.com/docker/go-units - name: github.com/docker/go-units
version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
- name: github.com/funcy/functions_go - name: github.com/funcy/functions_go
version: 3b83bbd98c2a5909eea3ccfafe3730a9822d15ee version: 5d9948e8b1292c5421b5dd98bb6a9b5535d5e1ba
subpackages: subpackages:
- client - client
- client/apps - client/apps
- client/call - client/call
- client/operations
- client/routes - client/routes
- client/tasks - client/tasks
- client/version - client/version

View File

@@ -1 +1 @@
0.1.32 0.1.33

View File

@@ -11,6 +11,7 @@ import (
"github.com/funcy/functions_go/client/apps" "github.com/funcy/functions_go/client/apps"
"github.com/funcy/functions_go/client/call" "github.com/funcy/functions_go/client/call"
"github.com/funcy/functions_go/client/operations"
"github.com/funcy/functions_go/client/routes" "github.com/funcy/functions_go/client/routes"
"github.com/funcy/functions_go/client/tasks" "github.com/funcy/functions_go/client/tasks"
"github.com/funcy/functions_go/client/version" "github.com/funcy/functions_go/client/version"
@@ -61,6 +62,8 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Functions
cli.Call = call.New(transport, formats) cli.Call = call.New(transport, formats)
cli.Operations = operations.New(transport, formats)
cli.Routes = routes.New(transport, formats) cli.Routes = routes.New(transport, formats)
cli.Tasks = tasks.New(transport, formats) cli.Tasks = tasks.New(transport, formats)
@@ -115,6 +118,8 @@ type Functions struct {
Call *call.Client Call *call.Client
Operations *operations.Client
Routes *routes.Client Routes *routes.Client
Tasks *tasks.Client Tasks *tasks.Client
@@ -132,6 +137,8 @@ func (c *Functions) SetTransport(transport runtime.ClientTransport) {
c.Call.SetTransport(transport) c.Call.SetTransport(transport)
c.Operations.SetTransport(transport)
c.Routes.SetTransport(transport) c.Routes.SetTransport(transport)
c.Tasks.SetTransport(transport) c.Tasks.SetTransport(transport)

View File

@@ -0,0 +1,135 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"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"
)
// NewDeleteCallsCallLogParams creates a new DeleteCallsCallLogParams object
// with the default values initialized.
func NewDeleteCallsCallLogParams() *DeleteCallsCallLogParams {
var ()
return &DeleteCallsCallLogParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteCallsCallLogParamsWithTimeout creates a new DeleteCallsCallLogParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteCallsCallLogParamsWithTimeout(timeout time.Duration) *DeleteCallsCallLogParams {
var ()
return &DeleteCallsCallLogParams{
timeout: timeout,
}
}
// NewDeleteCallsCallLogParamsWithContext creates a new DeleteCallsCallLogParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteCallsCallLogParamsWithContext(ctx context.Context) *DeleteCallsCallLogParams {
var ()
return &DeleteCallsCallLogParams{
Context: ctx,
}
}
// NewDeleteCallsCallLogParamsWithHTTPClient creates a new DeleteCallsCallLogParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteCallsCallLogParamsWithHTTPClient(client *http.Client) *DeleteCallsCallLogParams {
var ()
return &DeleteCallsCallLogParams{
HTTPClient: client,
}
}
/*DeleteCallsCallLogParams contains all the parameters to send to the API endpoint
for the delete calls call log operation typically these are written to a http.Request
*/
type DeleteCallsCallLogParams struct {
/*Call
Call ID.
*/
Call string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete calls call log params
func (o *DeleteCallsCallLogParams) WithTimeout(timeout time.Duration) *DeleteCallsCallLogParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete calls call log params
func (o *DeleteCallsCallLogParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete calls call log params
func (o *DeleteCallsCallLogParams) WithContext(ctx context.Context) *DeleteCallsCallLogParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete calls call log params
func (o *DeleteCallsCallLogParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete calls call log params
func (o *DeleteCallsCallLogParams) WithHTTPClient(client *http.Client) *DeleteCallsCallLogParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete calls call log params
func (o *DeleteCallsCallLogParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCall adds the call to the delete calls call log params
func (o *DeleteCallsCallLogParams) WithCall(call string) *DeleteCallsCallLogParams {
o.SetCall(call)
return o
}
// SetCall adds the call to the delete calls call log params
func (o *DeleteCallsCallLogParams) SetCall(call string) {
o.Call = call
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteCallsCallLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param call
if err := r.SetPathParam("call", o.Call); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,138 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/funcy/functions_go/models"
)
// DeleteCallsCallLogReader is a Reader for the DeleteCallsCallLog structure.
type DeleteCallsCallLogReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteCallsCallLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 202:
result := NewDeleteCallsCallLogAccepted()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteCallsCallLogNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewDeleteCallsCallLogDefault(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
}
}
// NewDeleteCallsCallLogAccepted creates a DeleteCallsCallLogAccepted with default headers values
func NewDeleteCallsCallLogAccepted() *DeleteCallsCallLogAccepted {
return &DeleteCallsCallLogAccepted{}
}
/*DeleteCallsCallLogAccepted handles this case with default header values.
Log delete request accepted
*/
type DeleteCallsCallLogAccepted struct {
}
func (o *DeleteCallsCallLogAccepted) Error() string {
return fmt.Sprintf("[DELETE /calls/{call}/log][%d] deleteCallsCallLogAccepted ", 202)
}
func (o *DeleteCallsCallLogAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteCallsCallLogNotFound creates a DeleteCallsCallLogNotFound with default headers values
func NewDeleteCallsCallLogNotFound() *DeleteCallsCallLogNotFound {
return &DeleteCallsCallLogNotFound{}
}
/*DeleteCallsCallLogNotFound handles this case with default header values.
Does not exist.
*/
type DeleteCallsCallLogNotFound struct {
Payload *models.Error
}
func (o *DeleteCallsCallLogNotFound) Error() string {
return fmt.Sprintf("[DELETE /calls/{call}/log][%d] deleteCallsCallLogNotFound %+v", 404, o.Payload)
}
func (o *DeleteCallsCallLogNotFound) 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
}
// NewDeleteCallsCallLogDefault creates a DeleteCallsCallLogDefault with default headers values
func NewDeleteCallsCallLogDefault(code int) *DeleteCallsCallLogDefault {
return &DeleteCallsCallLogDefault{
_statusCode: code,
}
}
/*DeleteCallsCallLogDefault handles this case with default header values.
Unexpected error
*/
type DeleteCallsCallLogDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the delete calls call log default response
func (o *DeleteCallsCallLogDefault) Code() int {
return o._statusCode
}
func (o *DeleteCallsCallLogDefault) Error() string {
return fmt.Sprintf("[DELETE /calls/{call}/log][%d] DeleteCallsCallLog default %+v", o._statusCode, o.Payload)
}
func (o *DeleteCallsCallLogDefault) 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 operations
// This 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"
)
// NewGetCallsCallLogParams creates a new GetCallsCallLogParams object
// with the default values initialized.
func NewGetCallsCallLogParams() *GetCallsCallLogParams {
var ()
return &GetCallsCallLogParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetCallsCallLogParamsWithTimeout creates a new GetCallsCallLogParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetCallsCallLogParamsWithTimeout(timeout time.Duration) *GetCallsCallLogParams {
var ()
return &GetCallsCallLogParams{
timeout: timeout,
}
}
// NewGetCallsCallLogParamsWithContext creates a new GetCallsCallLogParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetCallsCallLogParamsWithContext(ctx context.Context) *GetCallsCallLogParams {
var ()
return &GetCallsCallLogParams{
Context: ctx,
}
}
// NewGetCallsCallLogParamsWithHTTPClient creates a new GetCallsCallLogParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetCallsCallLogParamsWithHTTPClient(client *http.Client) *GetCallsCallLogParams {
var ()
return &GetCallsCallLogParams{
HTTPClient: client,
}
}
/*GetCallsCallLogParams contains all the parameters to send to the API endpoint
for the get calls call log operation typically these are written to a http.Request
*/
type GetCallsCallLogParams struct {
/*Call
Call ID.
*/
Call string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get calls call log params
func (o *GetCallsCallLogParams) WithTimeout(timeout time.Duration) *GetCallsCallLogParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get calls call log params
func (o *GetCallsCallLogParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get calls call log params
func (o *GetCallsCallLogParams) WithContext(ctx context.Context) *GetCallsCallLogParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get calls call log params
func (o *GetCallsCallLogParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get calls call log params
func (o *GetCallsCallLogParams) WithHTTPClient(client *http.Client) *GetCallsCallLogParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get calls call log params
func (o *GetCallsCallLogParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCall adds the call to the get calls call log params
func (o *GetCallsCallLogParams) WithCall(call string) *GetCallsCallLogParams {
o.SetCall(call)
return o
}
// SetCall adds the call to the get calls call log params
func (o *GetCallsCallLogParams) SetCall(call string) {
o.Call = call
}
// WriteToRequest writes these params to a swagger request
func (o *GetCallsCallLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param call
if err := r.SetPathParam("call", o.Call); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,101 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
"github.com/funcy/functions_go/models"
)
// GetCallsCallLogReader is a Reader for the GetCallsCallLog structure.
type GetCallsCallLogReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetCallsCallLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetCallsCallLogOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetCallsCallLogNotFound()
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())
}
}
// NewGetCallsCallLogOK creates a GetCallsCallLogOK with default headers values
func NewGetCallsCallLogOK() *GetCallsCallLogOK {
return &GetCallsCallLogOK{}
}
/*GetCallsCallLogOK handles this case with default header values.
Log found
*/
type GetCallsCallLogOK struct {
Payload *models.LogWrapper
}
func (o *GetCallsCallLogOK) Error() string {
return fmt.Sprintf("[GET /calls/{call}/log][%d] getCallsCallLogOK %+v", 200, o.Payload)
}
func (o *GetCallsCallLogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.LogWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetCallsCallLogNotFound creates a GetCallsCallLogNotFound with default headers values
func NewGetCallsCallLogNotFound() *GetCallsCallLogNotFound {
return &GetCallsCallLogNotFound{}
}
/*GetCallsCallLogNotFound handles this case with default header values.
Log not found.
*/
type GetCallsCallLogNotFound struct {
Payload *models.Error
}
func (o *GetCallsCallLogNotFound) Error() string {
return fmt.Sprintf("[GET /calls/{call}/log][%d] getCallsCallLogNotFound %+v", 404, o.Payload)
}
func (o *GetCallsCallLogNotFound) 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,88 @@
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new operations API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for operations API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
DeleteCallsCallLog deletes call log entry
Delete call log entry
*/
func (a *Client) DeleteCallsCallLog(params *DeleteCallsCallLogParams) (*DeleteCallsCallLogAccepted, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteCallsCallLogParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteCallsCallLog",
Method: "DELETE",
PathPattern: "/calls/{call}/log",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteCallsCallLogReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteCallsCallLogAccepted), nil
}
/*
GetCallsCallLog gets call logs
Get call logs
*/
func (a *Client) GetCallsCallLog(params *GetCallsCallLogParams) (*GetCallsCallLogOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetCallsCallLogParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetCallsCallLog",
Method: "GET",
PathPattern: "/calls/{call}/log",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetCallsCallLogReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetCallsCallLogOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

50
fn/vendor/github.com/funcy/functions_go/models/log.go generated vendored Normal file
View File

@@ -0,0 +1,50 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// Log log
// swagger:model Log
type Log struct {
// Call UUID ID
CallID string `json:"call_id,omitempty"`
// log
Log string `json:"log,omitempty"`
}
// Validate validates this log
func (m *Log) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *Log) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Log) UnmarshalBinary(b []byte) error {
var res Log
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,73 @@
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// LogWrapper log wrapper
// swagger:model LogWrapper
type LogWrapper struct {
// Call log entry.
// Required: true
Log *Log `json:"log"`
}
// Validate validates this log wrapper
func (m *LogWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLog(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *LogWrapper) validateLog(formats strfmt.Registry) error {
if err := validate.Required("log", "body", m.Log); err != nil {
return err
}
if m.Log != nil {
if err := m.Log.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("log")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *LogWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LogWrapper) UnmarshalBinary(b []byte) error {
var res LogWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -21,7 +21,7 @@ type Route struct {
Config map[string]string `json:"config,omitempty"` Config map[string]string `json:"config,omitempty"`
// Payload format sent into function. // Payload format sent into function.
Format interface{} `json:"format,omitempty"` Format string `json:"format,omitempty"`
// Map of http headers that will be sent with the response // Map of http headers that will be sent with the response
Headers map[string][]string `json:"headers,omitempty"` Headers map[string][]string `json:"headers,omitempty"`
@@ -32,9 +32,6 @@ type Route struct {
// Name of Docker image to use in this route. You should include the image tag, which should be a version number, to be more accurate. Can be overridden on a per route basis with route.image. // Name of Docker image to use in this route. You should include the image tag, which should be a version number, to be more accurate. Can be overridden on a per route basis with route.image.
Image string `json:"image,omitempty"` Image string `json:"image,omitempty"`
// Maximum number of hot functions concurrency
MaxConcurrency int32 `json:"max_concurrency,omitempty"`
// Max usable memory for this route (MiB). // Max usable memory for this route (MiB).
Memory int64 `json:"memory,omitempty"` Memory int64 `json:"memory,omitempty"`
@@ -46,7 +43,7 @@ type Route struct {
Timeout *int32 `json:"timeout,omitempty"` Timeout *int32 `json:"timeout,omitempty"`
// Route type // Route type
Type interface{} `json:"type,omitempty"` Type string `json:"type,omitempty"`
} }
// Validate validates this route // Validate validates this route
@@ -77,7 +74,7 @@ func (m *Route) Validate(formats strfmt.Registry) error {
var routeTypeFormatPropEnum []interface{} var routeTypeFormatPropEnum []interface{}
func init() { func init() {
var res []interface{} var res []string
if err := json.Unmarshal([]byte(`["default","http","json"]`), &res); err != nil { if err := json.Unmarshal([]byte(`["default","http","json"]`), &res); err != nil {
panic(err) panic(err)
} }
@@ -86,8 +83,17 @@ func init() {
} }
} }
const (
// RouteFormatDefault captures enum value "default"
RouteFormatDefault string = "default"
// RouteFormatHTTP captures enum value "http"
RouteFormatHTTP string = "http"
// RouteFormatJSON captures enum value "json"
RouteFormatJSON string = "json"
)
// prop value enum // prop value enum
func (m *Route) validateFormatEnum(path, location string, value interface{}) error { func (m *Route) validateFormatEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, routeTypeFormatPropEnum); err != nil { if err := validate.Enum(path, location, value, routeTypeFormatPropEnum); err != nil {
return err return err
} }
@@ -100,6 +106,11 @@ func (m *Route) validateFormat(formats strfmt.Registry) error {
return nil return nil
} }
// value enum
if err := m.validateFormatEnum("format", "body", m.Format); err != nil {
return err
}
return nil return nil
} }
@@ -119,7 +130,7 @@ func (m *Route) validateHeaders(formats strfmt.Registry) error {
var routeTypeTypePropEnum []interface{} var routeTypeTypePropEnum []interface{}
func init() { func init() {
var res []interface{} var res []string
if err := json.Unmarshal([]byte(`["sync","async"]`), &res); err != nil { if err := json.Unmarshal([]byte(`["sync","async"]`), &res); err != nil {
panic(err) panic(err)
} }
@@ -128,8 +139,15 @@ func init() {
} }
} }
const (
// RouteTypeSync captures enum value "sync"
RouteTypeSync string = "sync"
// RouteTypeAsync captures enum value "async"
RouteTypeAsync string = "async"
)
// prop value enum // prop value enum
func (m *Route) validateTypeEnum(path, location string, value interface{}) error { func (m *Route) validateTypeEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, routeTypeTypePropEnum); err != nil { if err := validate.Enum(path, location, value, routeTypeTypePropEnum); err != nil {
return err return err
} }
@@ -142,6 +160,11 @@ func (m *Route) validateType(formats strfmt.Registry) error {
return nil return nil
} }
// value enum
if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
return err
}
return nil return nil
} }

View File

@@ -16,7 +16,6 @@ import (
// Task task // Task task
// swagger:model Task // swagger:model Task
type Task struct { type Task struct {
NewTask
// Time when task completed, whether it was successul or failed. Always in UTC. // Time when task completed, whether it was successul or failed. Always in UTC.
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"` CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
@@ -35,6 +34,13 @@ type Task struct {
// Read Only: true // Read Only: true
GroupName string `json:"group_name,omitempty"` GroupName string `json:"group_name,omitempty"`
// Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
// Required: true
Image *string `json:"image"`
// Payload for the task. This is what you pass into each task to make it do something.
Payload string `json:"payload,omitempty"`
// Machine usable reason for task being in this state. // Machine usable reason for task being in this state.
// Valid values for error status are `timeout | killed | bad_exit`. // Valid values for error status are `timeout | killed | bad_exit`.
// Valid values for cancelled status are `client_request`. // Valid values for cancelled status are `client_request`.
@@ -54,125 +60,17 @@ type Task struct {
StartedAt strfmt.DateTime `json:"started_at,omitempty"` StartedAt strfmt.DateTime `json:"started_at,omitempty"`
} }
// UnmarshalJSON unmarshals this object from a JSON structure
func (m *Task) UnmarshalJSON(raw []byte) error {
var aO0 NewTask
if err := swag.ReadJSON(raw, &aO0); err != nil {
return err
}
m.NewTask = aO0
var data struct {
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
EnvVars map[string]string `json:"env_vars,omitempty"`
Error string `json:"error,omitempty"`
GroupName string `json:"group_name,omitempty"`
Reason string `json:"reason,omitempty"`
RetryAt string `json:"retry_at,omitempty"`
RetryOf string `json:"retry_of,omitempty"`
StartedAt strfmt.DateTime `json:"started_at,omitempty"`
}
if err := swag.ReadJSON(raw, &data); err != nil {
return err
}
m.CompletedAt = data.CompletedAt
m.CreatedAt = data.CreatedAt
m.EnvVars = data.EnvVars
m.Error = data.Error
m.GroupName = data.GroupName
m.Reason = data.Reason
m.RetryAt = data.RetryAt
m.RetryOf = data.RetryOf
m.StartedAt = data.StartedAt
return nil
}
// MarshalJSON marshals this object to a JSON structure
func (m Task) MarshalJSON() ([]byte, error) {
var _parts [][]byte
aO0, err := swag.WriteJSON(m.NewTask)
if err != nil {
return nil, err
}
_parts = append(_parts, aO0)
var data struct {
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
EnvVars map[string]string `json:"env_vars,omitempty"`
Error string `json:"error,omitempty"`
GroupName string `json:"group_name,omitempty"`
Reason string `json:"reason,omitempty"`
RetryAt string `json:"retry_at,omitempty"`
RetryOf string `json:"retry_of,omitempty"`
StartedAt strfmt.DateTime `json:"started_at,omitempty"`
}
data.CompletedAt = m.CompletedAt
data.CreatedAt = m.CreatedAt
data.EnvVars = m.EnvVars
data.Error = m.Error
data.GroupName = m.GroupName
data.Reason = m.Reason
data.RetryAt = m.RetryAt
data.RetryOf = m.RetryOf
data.StartedAt = m.StartedAt
jsonData, err := swag.WriteJSON(data)
if err != nil {
return nil, err
}
_parts = append(_parts, jsonData)
return swag.ConcatJSON(_parts...), nil
}
// Validate validates this task // Validate validates this task
func (m *Task) Validate(formats strfmt.Registry) error { func (m *Task) Validate(formats strfmt.Registry) error {
var res []error var res []error
if err := m.NewTask.Validate(formats); err != nil { if err := m.validateImage(formats); err != nil {
// prop
res = append(res, err) res = append(res, err)
} }
if err := m.validateReason(formats); err != nil { if err := m.validateReason(formats); err != nil {
// prop
res = append(res, err) res = append(res, err)
} }
@@ -182,6 +80,15 @@ func (m *Task) Validate(formats strfmt.Registry) error {
return nil return nil
} }
func (m *Task) validateImage(formats strfmt.Registry) error {
if err := validate.Required("image", "body", m.Image); err != nil {
return err
}
return nil
}
var taskTypeReasonPropEnum []interface{} var taskTypeReasonPropEnum []interface{}
func init() { func init() {
@@ -194,7 +101,18 @@ func init() {
} }
} }
// property enum const (
// TaskReasonTimeout captures enum value "timeout"
TaskReasonTimeout string = "timeout"
// TaskReasonKilled captures enum value "killed"
TaskReasonKilled string = "killed"
// TaskReasonBadExit captures enum value "bad_exit"
TaskReasonBadExit string = "bad_exit"
// TaskReasonClientRequest captures enum value "client_request"
TaskReasonClientRequest string = "client_request"
)
// prop value enum
func (m *Task) validateReasonEnum(path, location string, value string) error { func (m *Task) validateReasonEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, taskTypeReasonPropEnum); err != nil { if err := validate.Enum(path, location, value, taskTypeReasonPropEnum); err != nil {
return err return err