mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
automagic sql db migrations (#461)
* adds migrations closes #57 migrations only run if the database is not brand new. brand new databases will contain all the right fields when CREATE TABLE is called, this is for readability mostly more than efficiency (do not want to have to go through all of the database migrations to ascertain what columns a table has). upon startup of a new database, the migrations will be analyzed and the highest version set, so that future migrations will be run. this should also avoid running through all the migrations, which could bork db's easily enough (if the user just exits from impatience, say). otherwise, all migrations that a db has not yet seen will be run against it upon startup, this should be seamless to the user whether they had a db that had 0 migrations run on it before or N. this means users will not have to explicitly run any migrations on their dbs nor see any errors when we upgrade the db (so long as things go well). if migrations do not go so well, users will have to manually repair dbs (this is the intention of the `migrate` library and it seems sane), this should be rare, and I'm unsure myself how best to resolve not having gone through this myself, I would assume it will require running down migrations and then manually updating the migration field; in any case, docs once one of us has to go through this. migrations are written to files and checked into version control, and then use go-bindata to generate those files into go code and compiled in to be consumed by the migrate library (so that we don't have to put migration files on any servers) -- this is also in vcs. this seems to work ok. I don't like having to use the separate go-bindata tool but it wasn't really hard to install and then go generate takes care of the args. adding migrations should be relatively rare anyway, but tried to make it pretty painless. 1 migration to add created_at to the route is done here as an example of how to do migrations, as well as testing these things ;) -- `created_at` will be `0001-01-01T00:00:00.000Z` for any existing routes after a user runs this version. could spend the extra time adding 'today's date to any outstanding records, but that's not really accurate, the main thing is nobody will have to nuke their db with the migrations in place & we don't have any prod clusters really to worry about. all future routes will correctly have `created_at` set, and plan to add other timestamps but wanted to keep this patch as small as possible so only did routes.created_at. there are tests that a spankin new db will work as expected as well as a db after running all down & up migrations works. the latter tests only run on mysql and postgres, since sqlite3 does not like ALTER TABLE DROP COLUMN; up migrations will need to be tested manually for sqlite3 only, but in theory if they are simple and work on postgres and mysql, there is a good likelihood of success; the new migration from this patch works on sqlite3 fine. for now, we need to use `github.com/rdallman/migrate` to move forward, as getting integrated into upstream is proving difficult due to `github.com/go-sql-driver/mysql` being broken on master (yay dependencies). Fortunately for us, we vendor a version of the `mysql` bindings that actually works, thus, we are capable of using the `mattes/migrate` library with success due to that. this also will require go1.9 to use the new `database/sql.Conn` type, CI has been updated accordingly. some doc fixes too from testing.. and of course updated all deps. anyway, whew. this should let us add fields to the db without busting everybody's dbs. open to feedback on better ways, but this was overall pretty simple despite futzing with mysql. * add migrate pkg to deps, update deps use rdallman/migrate until we resolve in mattes land * add README in migrations package * add ref to mattes lib
This commit is contained in:
2
vendor/github.com/fnproject/fn_go/VERSION
generated
vendored
2
vendor/github.com/fnproject/fn_go/VERSION
generated
vendored
@@ -1 +1 @@
|
||||
0.2.0
|
||||
0.2.1
|
||||
2
vendor/github.com/fnproject/fn_go/client/apps/apps_client.go
generated
vendored
2
vendor/github.com/fnproject/fn_go/client/apps/apps_client.go
generated
vendored
@@ -57,7 +57,7 @@ func (a *Client) DeleteAppsApp(params *DeleteAppsAppParams) (*DeleteAppsAppOK, e
|
||||
/*
|
||||
GetApps gets all app names
|
||||
|
||||
Get a list of all the apps in the system.
|
||||
Get a list of all the apps in the system, returned in alphabetical order.
|
||||
*/
|
||||
func (a *Client) GetApps(params *GetAppsParams) (*GetAppsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
75
vendor/github.com/fnproject/fn_go/client/apps/get_apps_parameters.go
generated
vendored
75
vendor/github.com/fnproject/fn_go/client/apps/get_apps_parameters.go
generated
vendored
@@ -14,6 +14,7 @@ import (
|
||||
"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"
|
||||
)
|
||||
@@ -21,7 +22,7 @@ import (
|
||||
// NewGetAppsParams creates a new GetAppsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetAppsParams() *GetAppsParams {
|
||||
|
||||
var ()
|
||||
return &GetAppsParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
@@ -31,7 +32,7 @@ func NewGetAppsParams() *GetAppsParams {
|
||||
// NewGetAppsParamsWithTimeout creates a new GetAppsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewGetAppsParamsWithTimeout(timeout time.Duration) *GetAppsParams {
|
||||
|
||||
var ()
|
||||
return &GetAppsParams{
|
||||
|
||||
timeout: timeout,
|
||||
@@ -41,7 +42,7 @@ func NewGetAppsParamsWithTimeout(timeout time.Duration) *GetAppsParams {
|
||||
// NewGetAppsParamsWithContext creates a new GetAppsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewGetAppsParamsWithContext(ctx context.Context) *GetAppsParams {
|
||||
|
||||
var ()
|
||||
return &GetAppsParams{
|
||||
|
||||
Context: ctx,
|
||||
@@ -51,7 +52,7 @@ func NewGetAppsParamsWithContext(ctx context.Context) *GetAppsParams {
|
||||
// NewGetAppsParamsWithHTTPClient creates a new GetAppsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewGetAppsParamsWithHTTPClient(client *http.Client) *GetAppsParams {
|
||||
|
||||
var ()
|
||||
return &GetAppsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
@@ -61,6 +62,18 @@ func NewGetAppsParamsWithHTTPClient(client *http.Client) *GetAppsParams {
|
||||
for the get apps operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetAppsParams struct {
|
||||
|
||||
/*Cursor
|
||||
Cursor from previous response.next_cursor to begin results after, if any.
|
||||
|
||||
*/
|
||||
Cursor *string
|
||||
/*PerPage
|
||||
Number of results to return, defaults to 30. Max of 100.
|
||||
|
||||
*/
|
||||
PerPage *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
@@ -99,6 +112,28 @@ func (o *GetAppsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithCursor adds the cursor to the get apps params
|
||||
func (o *GetAppsParams) WithCursor(cursor *string) *GetAppsParams {
|
||||
o.SetCursor(cursor)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetCursor adds the cursor to the get apps params
|
||||
func (o *GetAppsParams) SetCursor(cursor *string) {
|
||||
o.Cursor = cursor
|
||||
}
|
||||
|
||||
// WithPerPage adds the perPage to the get apps params
|
||||
func (o *GetAppsParams) WithPerPage(perPage *int64) *GetAppsParams {
|
||||
o.SetPerPage(perPage)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPerPage adds the perPage to the get apps params
|
||||
func (o *GetAppsParams) SetPerPage(perPage *int64) {
|
||||
o.PerPage = perPage
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
@@ -107,6 +142,38 @@ func (o *GetAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Cursor != nil {
|
||||
|
||||
// query param cursor
|
||||
var qrCursor string
|
||||
if o.Cursor != nil {
|
||||
qrCursor = *o.Cursor
|
||||
}
|
||||
qCursor := qrCursor
|
||||
if qCursor != "" {
|
||||
if err := r.SetQueryParam("cursor", qCursor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.PerPage != nil {
|
||||
|
||||
// query param per_page
|
||||
var qrPerPage int64
|
||||
if o.PerPage != nil {
|
||||
qrPerPage = *o.PerPage
|
||||
}
|
||||
qPerPage := swag.FormatInt64(qrPerPage)
|
||||
if qPerPage != "" {
|
||||
if err := r.SetQueryParam("per_page", qPerPage); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
10
vendor/github.com/fnproject/fn_go/client/apps/patch_apps_app_parameters.go
generated
vendored
10
vendor/github.com/fnproject/fn_go/client/apps/patch_apps_app_parameters.go
generated
vendored
@@ -148,12 +148,10 @@ func (o *PatchAppsAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
|
||||
return err
|
||||
}
|
||||
|
||||
if o.Body == nil {
|
||||
o.Body = new(models.AppWrapper)
|
||||
}
|
||||
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
|
||||
10
vendor/github.com/fnproject/fn_go/client/apps/post_apps_parameters.go
generated
vendored
10
vendor/github.com/fnproject/fn_go/client/apps/post_apps_parameters.go
generated
vendored
@@ -127,12 +127,10 @@ func (o *PostAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Body == nil {
|
||||
o.Body = new(models.AppWrapper)
|
||||
}
|
||||
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
|
||||
2
vendor/github.com/fnproject/fn_go/client/call/call_client.go
generated
vendored
2
vendor/github.com/fnproject/fn_go/client/call/call_client.go
generated
vendored
@@ -27,7 +27,7 @@ type Client struct {
|
||||
/*
|
||||
GetAppsAppCalls gets app bound calls
|
||||
|
||||
Get app-bound calls can filter to route-bound calls.
|
||||
Get app-bound calls can filter to route-bound calls, results returned in created_at, descending order (newest first).
|
||||
*/
|
||||
func (a *Client) GetAppsAppCalls(params *GetAppsAppCallsParams) (*GetAppsAppCallsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
163
vendor/github.com/fnproject/fn_go/client/call/get_apps_app_calls_parameters.go
generated
vendored
163
vendor/github.com/fnproject/fn_go/client/call/get_apps_app_calls_parameters.go
generated
vendored
@@ -14,6 +14,7 @@ import (
|
||||
"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"
|
||||
)
|
||||
@@ -67,11 +68,31 @@ type GetAppsAppCallsParams struct {
|
||||
|
||||
*/
|
||||
App string
|
||||
/*Route
|
||||
App route.
|
||||
/*Cursor
|
||||
Cursor from previous response.next_cursor to begin results after, if any.
|
||||
|
||||
*/
|
||||
Route *string
|
||||
Cursor *string
|
||||
/*FromTime
|
||||
Unix timestamp in seconds, of call.created_at to begin the results at, default 0.
|
||||
|
||||
*/
|
||||
FromTime *int64
|
||||
/*Path
|
||||
Route path to match, exact.
|
||||
|
||||
*/
|
||||
Path *string
|
||||
/*PerPage
|
||||
Number of results to return, defaults to 30. Max of 100.
|
||||
|
||||
*/
|
||||
PerPage *int64
|
||||
/*ToTime
|
||||
Unix timestamp in seconds, of call.created_at to end the results at, defaults to latest.
|
||||
|
||||
*/
|
||||
ToTime *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@@ -122,15 +143,59 @@ func (o *GetAppsAppCallsParams) SetApp(app string) {
|
||||
o.App = app
|
||||
}
|
||||
|
||||
// WithRoute adds the route to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) WithRoute(route *string) *GetAppsAppCallsParams {
|
||||
o.SetRoute(route)
|
||||
// WithCursor adds the cursor to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) WithCursor(cursor *string) *GetAppsAppCallsParams {
|
||||
o.SetCursor(cursor)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRoute adds the route to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) SetRoute(route *string) {
|
||||
o.Route = route
|
||||
// SetCursor adds the cursor to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) SetCursor(cursor *string) {
|
||||
o.Cursor = cursor
|
||||
}
|
||||
|
||||
// WithFromTime adds the fromTime to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) WithFromTime(fromTime *int64) *GetAppsAppCallsParams {
|
||||
o.SetFromTime(fromTime)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetFromTime adds the fromTime to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) SetFromTime(fromTime *int64) {
|
||||
o.FromTime = fromTime
|
||||
}
|
||||
|
||||
// WithPath adds the path to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) WithPath(path *string) *GetAppsAppCallsParams {
|
||||
o.SetPath(path)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPath adds the path to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) SetPath(path *string) {
|
||||
o.Path = path
|
||||
}
|
||||
|
||||
// WithPerPage adds the perPage to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) WithPerPage(perPage *int64) *GetAppsAppCallsParams {
|
||||
o.SetPerPage(perPage)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPerPage adds the perPage to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) SetPerPage(perPage *int64) {
|
||||
o.PerPage = perPage
|
||||
}
|
||||
|
||||
// WithToTime adds the toTime to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) WithToTime(toTime *int64) *GetAppsAppCallsParams {
|
||||
o.SetToTime(toTime)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetToTime adds the toTime to the get apps app calls params
|
||||
func (o *GetAppsAppCallsParams) SetToTime(toTime *int64) {
|
||||
o.ToTime = toTime
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
@@ -146,16 +211,80 @@ func (o *GetAppsAppCallsParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
return err
|
||||
}
|
||||
|
||||
if o.Route != nil {
|
||||
if o.Cursor != nil {
|
||||
|
||||
// query param route
|
||||
var qrRoute string
|
||||
if o.Route != nil {
|
||||
qrRoute = *o.Route
|
||||
// query param cursor
|
||||
var qrCursor string
|
||||
if o.Cursor != nil {
|
||||
qrCursor = *o.Cursor
|
||||
}
|
||||
qRoute := qrRoute
|
||||
if qRoute != "" {
|
||||
if err := r.SetQueryParam("route", qRoute); err != nil {
|
||||
qCursor := qrCursor
|
||||
if qCursor != "" {
|
||||
if err := r.SetQueryParam("cursor", qCursor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.FromTime != nil {
|
||||
|
||||
// query param from_time
|
||||
var qrFromTime int64
|
||||
if o.FromTime != nil {
|
||||
qrFromTime = *o.FromTime
|
||||
}
|
||||
qFromTime := swag.FormatInt64(qrFromTime)
|
||||
if qFromTime != "" {
|
||||
if err := r.SetQueryParam("from_time", qFromTime); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Path != nil {
|
||||
|
||||
// query param path
|
||||
var qrPath string
|
||||
if o.Path != nil {
|
||||
qrPath = *o.Path
|
||||
}
|
||||
qPath := qrPath
|
||||
if qPath != "" {
|
||||
if err := r.SetQueryParam("path", qPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.PerPage != nil {
|
||||
|
||||
// query param per_page
|
||||
var qrPerPage int64
|
||||
if o.PerPage != nil {
|
||||
qrPerPage = *o.PerPage
|
||||
}
|
||||
qPerPage := swag.FormatInt64(qrPerPage)
|
||||
if qPerPage != "" {
|
||||
if err := r.SetQueryParam("per_page", qPerPage); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.ToTime != nil {
|
||||
|
||||
// query param to_time
|
||||
var qrToTime int64
|
||||
if o.ToTime != nil {
|
||||
qrToTime = *o.ToTime
|
||||
}
|
||||
qToTime := swag.FormatInt64(qrToTime)
|
||||
if qToTime != "" {
|
||||
if err := r.SetQueryParam("to_time", qToTime); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
97
vendor/github.com/fnproject/fn_go/client/routes/get_apps_app_routes_parameters.go
generated
vendored
97
vendor/github.com/fnproject/fn_go/client/routes/get_apps_app_routes_parameters.go
generated
vendored
@@ -14,6 +14,7 @@ import (
|
||||
"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"
|
||||
)
|
||||
@@ -67,6 +68,21 @@ type GetAppsAppRoutesParams struct {
|
||||
|
||||
*/
|
||||
App string
|
||||
/*Cursor
|
||||
Cursor from previous response.next_cursor to begin results after, if any.
|
||||
|
||||
*/
|
||||
Cursor *string
|
||||
/*Image
|
||||
Route image to match, exact.
|
||||
|
||||
*/
|
||||
Image *string
|
||||
/*PerPage
|
||||
Number of results to return, defaults to 30. Max of 100.
|
||||
|
||||
*/
|
||||
PerPage *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@@ -117,6 +133,39 @@ func (o *GetAppsAppRoutesParams) SetApp(app string) {
|
||||
o.App = app
|
||||
}
|
||||
|
||||
// WithCursor adds the cursor to the get apps app routes params
|
||||
func (o *GetAppsAppRoutesParams) WithCursor(cursor *string) *GetAppsAppRoutesParams {
|
||||
o.SetCursor(cursor)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetCursor adds the cursor to the get apps app routes params
|
||||
func (o *GetAppsAppRoutesParams) SetCursor(cursor *string) {
|
||||
o.Cursor = cursor
|
||||
}
|
||||
|
||||
// WithImage adds the image to the get apps app routes params
|
||||
func (o *GetAppsAppRoutesParams) WithImage(image *string) *GetAppsAppRoutesParams {
|
||||
o.SetImage(image)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetImage adds the image to the get apps app routes params
|
||||
func (o *GetAppsAppRoutesParams) SetImage(image *string) {
|
||||
o.Image = image
|
||||
}
|
||||
|
||||
// WithPerPage adds the perPage to the get apps app routes params
|
||||
func (o *GetAppsAppRoutesParams) WithPerPage(perPage *int64) *GetAppsAppRoutesParams {
|
||||
o.SetPerPage(perPage)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPerPage adds the perPage to the get apps app routes params
|
||||
func (o *GetAppsAppRoutesParams) SetPerPage(perPage *int64) {
|
||||
o.PerPage = perPage
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetAppsAppRoutesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
@@ -130,6 +179,54 @@ func (o *GetAppsAppRoutesParams) WriteToRequest(r runtime.ClientRequest, reg str
|
||||
return err
|
||||
}
|
||||
|
||||
if o.Cursor != nil {
|
||||
|
||||
// query param cursor
|
||||
var qrCursor string
|
||||
if o.Cursor != nil {
|
||||
qrCursor = *o.Cursor
|
||||
}
|
||||
qCursor := qrCursor
|
||||
if qCursor != "" {
|
||||
if err := r.SetQueryParam("cursor", qCursor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Image != nil {
|
||||
|
||||
// query param image
|
||||
var qrImage string
|
||||
if o.Image != nil {
|
||||
qrImage = *o.Image
|
||||
}
|
||||
qImage := qrImage
|
||||
if qImage != "" {
|
||||
if err := r.SetQueryParam("image", qImage); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.PerPage != nil {
|
||||
|
||||
// query param per_page
|
||||
var qrPerPage int64
|
||||
if o.PerPage != nil {
|
||||
qrPerPage = *o.PerPage
|
||||
}
|
||||
qPerPage := swag.FormatInt64(qrPerPage)
|
||||
if qPerPage != "" {
|
||||
if err := r.SetQueryParam("per_page", qPerPage); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
@@ -164,12 +164,10 @@ func (o *PatchAppsAppRoutesRouteParams) WriteToRequest(r runtime.ClientRequest,
|
||||
return err
|
||||
}
|
||||
|
||||
if o.Body == nil {
|
||||
o.Body = new(models.RouteWrapper)
|
||||
}
|
||||
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param route
|
||||
|
||||
10
vendor/github.com/fnproject/fn_go/client/routes/post_apps_app_routes_parameters.go
generated
vendored
10
vendor/github.com/fnproject/fn_go/client/routes/post_apps_app_routes_parameters.go
generated
vendored
@@ -148,12 +148,10 @@ func (o *PostAppsAppRoutesParams) WriteToRequest(r runtime.ClientRequest, reg st
|
||||
return err
|
||||
}
|
||||
|
||||
if o.Body == nil {
|
||||
o.Body = new(models.RouteWrapper)
|
||||
}
|
||||
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
|
||||
10
vendor/github.com/fnproject/fn_go/client/routes/put_apps_app_routes_route_parameters.go
generated
vendored
10
vendor/github.com/fnproject/fn_go/client/routes/put_apps_app_routes_route_parameters.go
generated
vendored
@@ -164,12 +164,10 @@ func (o *PutAppsAppRoutesRouteParams) WriteToRequest(r runtime.ClientRequest, re
|
||||
return err
|
||||
}
|
||||
|
||||
if o.Body == nil {
|
||||
o.Body = new(models.RouteWrapper)
|
||||
}
|
||||
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param route
|
||||
|
||||
2
vendor/github.com/fnproject/fn_go/client/routes/routes_client.go
generated
vendored
2
vendor/github.com/fnproject/fn_go/client/routes/routes_client.go
generated
vendored
@@ -57,7 +57,7 @@ func (a *Client) DeleteAppsAppRoutesRoute(params *DeleteAppsAppRoutesRouteParams
|
||||
/*
|
||||
GetAppsAppRoutes gets route list by app name
|
||||
|
||||
This will list routes for a particular app.
|
||||
This will list routes for a particular app, returned in alphabetical order.
|
||||
*/
|
||||
func (a *Client) GetAppsAppRoutes(params *GetAppsAppRoutesParams) (*GetAppsAppRoutesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
2
vendor/github.com/fnproject/fn_go/models/app.go
generated
vendored
2
vendor/github.com/fnproject/fn_go/models/app.go
generated
vendored
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
type App struct {
|
||||
|
||||
// Application configuration
|
||||
// Application configuration, applied to all routes.
|
||||
Config map[string]string `json:"config,omitempty"`
|
||||
|
||||
// Name of this app. Must be different than the image name. Can ony contain alphanumeric, -, and _.
|
||||
|
||||
28
vendor/github.com/fnproject/fn_go/models/apps_wrapper.go
generated
vendored
28
vendor/github.com/fnproject/fn_go/models/apps_wrapper.go
generated
vendored
@@ -6,8 +6,6 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -22,16 +20,22 @@ type AppsWrapper struct {
|
||||
|
||||
// apps
|
||||
// Required: true
|
||||
Apps []*App `json:"apps"`
|
||||
Apps AppsWrapperApps `json:"apps"`
|
||||
|
||||
// error
|
||||
Error *ErrorBody `json:"error,omitempty"`
|
||||
|
||||
// cursor to send with subsequent request to receive the next page, if non-empty
|
||||
// Read Only: true
|
||||
NextCursor string `json:"next_cursor,omitempty"`
|
||||
}
|
||||
|
||||
/* polymorph AppsWrapper apps false */
|
||||
|
||||
/* polymorph AppsWrapper error false */
|
||||
|
||||
/* polymorph AppsWrapper next_cursor false */
|
||||
|
||||
// Validate validates this apps wrapper
|
||||
func (m *AppsWrapper) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -58,24 +62,6 @@ func (m *AppsWrapper) validateApps(formats strfmt.Registry) error {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Apps); i++ {
|
||||
|
||||
if swag.IsZero(m.Apps[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Apps[i] != nil {
|
||||
|
||||
if err := m.Apps[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("apps" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
48
vendor/github.com/fnproject/fn_go/models/apps_wrapper_apps.go
generated
vendored
Normal file
48
vendor/github.com/fnproject/fn_go/models/apps_wrapper_apps.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
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 (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// AppsWrapperApps apps wrapper apps
|
||||
// swagger:model appsWrapperApps
|
||||
|
||||
type AppsWrapperApps []*App
|
||||
|
||||
// Validate validates this apps wrapper apps
|
||||
func (m AppsWrapperApps) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m[i] != nil {
|
||||
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
28
vendor/github.com/fnproject/fn_go/models/calls_wrapper.go
generated
vendored
28
vendor/github.com/fnproject/fn_go/models/calls_wrapper.go
generated
vendored
@@ -6,8 +6,6 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -22,16 +20,22 @@ type CallsWrapper struct {
|
||||
|
||||
// calls
|
||||
// Required: true
|
||||
Calls []*Call `json:"calls"`
|
||||
Calls CallsWrapperCalls `json:"calls"`
|
||||
|
||||
// error
|
||||
Error *ErrorBody `json:"error,omitempty"`
|
||||
|
||||
// cursor to send with subsequent request to receive the next page, if non-empty
|
||||
// Read Only: true
|
||||
NextCursor string `json:"next_cursor,omitempty"`
|
||||
}
|
||||
|
||||
/* polymorph CallsWrapper calls false */
|
||||
|
||||
/* polymorph CallsWrapper error false */
|
||||
|
||||
/* polymorph CallsWrapper next_cursor false */
|
||||
|
||||
// Validate validates this calls wrapper
|
||||
func (m *CallsWrapper) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -58,24 +62,6 @@ func (m *CallsWrapper) validateCalls(formats strfmt.Registry) error {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Calls); i++ {
|
||||
|
||||
if swag.IsZero(m.Calls[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Calls[i] != nil {
|
||||
|
||||
if err := m.Calls[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("calls" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
48
vendor/github.com/fnproject/fn_go/models/calls_wrapper_calls.go
generated
vendored
Normal file
48
vendor/github.com/fnproject/fn_go/models/calls_wrapper_calls.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
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 (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// CallsWrapperCalls calls wrapper calls
|
||||
// swagger:model callsWrapperCalls
|
||||
|
||||
type CallsWrapperCalls []*Call
|
||||
|
||||
// Validate validates this calls wrapper calls
|
||||
func (m CallsWrapperCalls) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m[i] != nil {
|
||||
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
28
vendor/github.com/fnproject/fn_go/models/routes_wrapper.go
generated
vendored
28
vendor/github.com/fnproject/fn_go/models/routes_wrapper.go
generated
vendored
@@ -6,8 +6,6 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -23,13 +21,19 @@ type RoutesWrapper struct {
|
||||
// error
|
||||
Error *ErrorBody `json:"error,omitempty"`
|
||||
|
||||
// cursor to send with subsequent request to receive the next page, if non-empty
|
||||
// Read Only: true
|
||||
NextCursor string `json:"next_cursor,omitempty"`
|
||||
|
||||
// routes
|
||||
// Required: true
|
||||
Routes []*Route `json:"routes"`
|
||||
Routes RoutesWrapperRoutes `json:"routes"`
|
||||
}
|
||||
|
||||
/* polymorph RoutesWrapper error false */
|
||||
|
||||
/* polymorph RoutesWrapper next_cursor false */
|
||||
|
||||
/* polymorph RoutesWrapper routes false */
|
||||
|
||||
// Validate validates this routes wrapper
|
||||
@@ -77,24 +81,6 @@ func (m *RoutesWrapper) validateRoutes(formats strfmt.Registry) error {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Routes); i++ {
|
||||
|
||||
if swag.IsZero(m.Routes[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Routes[i] != nil {
|
||||
|
||||
if err := m.Routes[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("routes" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
48
vendor/github.com/fnproject/fn_go/models/routes_wrapper_routes.go
generated
vendored
Normal file
48
vendor/github.com/fnproject/fn_go/models/routes_wrapper_routes.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
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 (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// RoutesWrapperRoutes routes wrapper routes
|
||||
// swagger:model routesWrapperRoutes
|
||||
|
||||
type RoutesWrapperRoutes []*Route
|
||||
|
||||
// Validate validates this routes wrapper routes
|
||||
func (m RoutesWrapperRoutes) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m[i] != nil {
|
||||
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user