Client generator update (#262)

* Generated a bunch of clients.

* Builds go client.

* Removed test line.

* Changed dependencies to fnproject/fn_go

* Fix tests.
This commit is contained in:
Travis Reeder
2017-09-14 10:57:22 -07:00
committed by GitHub
parent 0f6db73834
commit 9f87b1ead0
81 changed files with 18118 additions and 420 deletions

3
clients/Gemfile Normal file
View File

@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'http'

29
clients/Gemfile.lock Normal file
View File

@@ -0,0 +1,29 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
http (2.2.2)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 1.0.1)
http_parser.rb (~> 0.6.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (1.0.3)
http_parser.rb (0.6.0)
public_suffix (3.0.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.4)
PLATFORMS
ruby
DEPENDENCIES
http
BUNDLED WITH
1.15.1

View File

@@ -6,10 +6,8 @@
If this is your first time building the clients, you'll need to do the following:
1) Install this single gem:
```sh
gem install http
bundle install
```
### Every Time
@@ -22,12 +20,6 @@ ruby build.rb
Boom. That's it.
## Building with the Go Builder
```sh
go run main.go
```
## Troubleshooting
Sometimes this will fail due to github caching or something and versions will be off. Just bump version and retry.

View File

@@ -9,7 +9,6 @@ require_relative 'utils.rb'
swaggerUrl = "https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml"
spec = YAML.load(open(swaggerUrl))
version = spec['info']['version']
version = '0.1.30'
puts "VERSION: #{version}"
# Can pass in a particular language to only do that one
@@ -33,6 +32,7 @@ def clone(lang)
Dir.chdir '../'
end
Dir.chdir '../'
return "tmp/#{ldir}"
end
FileUtils.mkdir_p 'tmp'
@@ -44,25 +44,23 @@ else
languages = ['go', 'ruby', 'php', 'python', 'elixir', 'javascript'] # JSON.parse(HTTP.get("https://generator.swagger.io/api/gen/clients", ssl_context: ctx).body)
end
languages.each do |l|
puts l
puts "\nGenerating client for #{l}..."
lshort = l
# lang_options = JSON.parse(HTTP.get("https://generator.swagger.io/api/gen/clients/#{l}", ssl_context: ctx).body)
# p lang_options
# only going to do ruby and go for now
glob_pattern = ["**", "*"]
copy_dir = "."
options = {}
skip_files = []
deploy = []
clone_dir = ""
case l
when 'go'
clone(lshort)
clone_dir = clone(lshort)
glob_pattern = ['functions', "**", "*.go"]
copy_dir = "."
options['packageName'] = 'functions'
options['packageVersion'] = version
when 'ruby'
clone(l)
clone_dir = clone(l)
fruby = "fn_ruby"
gem_name = "fn_ruby"
glob_pattern = ["**", "*.rb"] # just rb files
@@ -78,60 +76,52 @@ languages.each do |l|
when 'javascript'
lshort = 'js'
# copy_dir = "javascript-client/."
clone(lshort)
clone_dir = clone(lshort)
options['projectName'] = "fn_js"
deploy << "npm publish"
else
clone_dir = clone(l)
end
p options
lv = "#{lshort}-#{version}"
destdir = "tmp/fn_#{lshort}"
if l == 'go'
puts "SKIPPING GO, it's manual for now."
# This is using https://goswagger.io/ instead
# TODO: run this build command instead: this works if run manually
# dep ensure && docker run --rm -it -v $HOME/dev/go:/go -w /go/src/github.com/treeder/functions_go quay.io/goswagger/swagger generate client -f https://raw.githubusercontent.com/treeder/functions/master/docs/swagger.yml -A functions
# cmd := exec.Command("docker", "run", "--rm", "-u", fmt.Sprintf("%s:%s", u.Uid, u.Gid), "-v", fmt.Sprintf("%s/%s:/go/src/github.com/funcy/functions_go", cwd, target), "-v", fmt.Sprintf("%s/%s:/go/swagger.spec", cwd, swaggerURL), "-w", "/go/src", "quay.io/goswagger/swagger", "generate", "client", "-f", "/go/swagger.spec", "-t", "github.com/funcy/functions_go", "-A", "functions")
# d, err := cmd.CombinedOutput()
# if err != nil {
# log.Printf("Error running go-swagger: %s\n", d)
# return err
# }
next
stream_exec "docker run --rm -v ${PWD}/#{clone_dir}:/go/src/github.com/fnproject/fn_go -w /go/src/github.com/fnproject/fn_go quay.io/goswagger/swagger generate client -f #{swaggerUrl} -A fn "
else
gen = JSON.parse(HTTP.post("https://generator.swagger.io/api/gen/clients/#{l}",
json: {
swaggerUrl: swaggerUrl,
options: options,
},
ssl_context: ctx).body)
json: {
swaggerUrl: swaggerUrl,
options: options,
},
ssl_context: ctx).body)
p gen
lv = "#{lshort}-#{version}"
zipfile = "tmp/#{lv}.zip"
stream_exec "curl -o #{zipfile} #{gen['link']} -k"
stream_exec "unzip -o #{zipfile} -d tmp/#{lv}"
end
# delete the skip_files
skip_files.each do |sf|
begin
File.delete("tmp/#{lv}/#{lshort}-client/" + sf)
rescue => ex
puts "Error deleting file: #{ex.backtrace}"
# delete the skip_files
skip_files.each do |sf|
begin
File.delete("tmp/#{lv}/#{lshort}-client/" + sf)
rescue => ex
puts "Error deleting file: #{ex.backtrace}"
end
end
end
# Copy into clone repos
fj = File.join(['tmp', lv, "#{l}-client"] + glob_pattern)
# FileUtils.mkdir_p "tmp/#{l}-copy"
# FileUtils.cp_r(Dir.glob(fj), "tmp/#{l}-copy")
destdir = "tmp/fn_#{lshort}"
puts "Trying cp", "tmp/#{lv}/#{l}-client/#{copy_dir}", destdir
FileUtils.cp_r("tmp/#{lv}/#{l}-client/#{copy_dir}", destdir)
# Write a version file, this ensures there's always a change.
# Copy into clone repos
fj = File.join(['tmp', lv, "#{l}-client"] + glob_pattern)
puts "Trying cp", "tmp/#{lv}/#{l}-client/#{copy_dir}", destdir
FileUtils.cp_r("tmp/#{lv}/#{l}-client/#{copy_dir}", destdir)
# Write a version file, this ensures there's always a change.
end
File.open("#{destdir}/VERSION", 'w') { |file| file.write(version) }
# Commit and push
begin
Dir.chdir("tmp/fn_#{lshort}")
Dir.chdir(destdir)
stream_exec "git add ."
stream_exec "git commit -am \"Updated to api version #{version}\""
begin
@@ -155,7 +145,3 @@ languages.each do |l|
Dir.chdir("../../")
end
# Uncomment the following lines if we start using the Go lib
# Dir.chdir("../")
# stream_exec "glide up"

View File

@@ -1,316 +0,0 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"os/user"
"path/filepath"
"strings"
"github.com/go-openapi/loads/fmts"
"github.com/go-openapi/spec"
)
const (
swaggerURL = "../docs/swagger.yml"
rootTmpDir = "tmp"
)
var cwd string
func main() {
os.RemoveAll(rootTmpDir)
cwd, _ = os.Getwd()
defer func() {
os.RemoveAll(rootTmpDir)
}()
// Download swagger yaml and convert to JSON
d, err := fmts.YAMLDoc(swaggerURL)
if err != nil {
log.Fatalf("Failed to convert swagger yaml to json: %v", err)
}
var sw spec.Swagger
if err := json.Unmarshal(d, &sw); err != nil {
log.Fatalf("Failed to convert swagger yaml to json: %v", err)
}
version := sw.Info.Version
fmt.Printf("VERSION: %s\n", version)
swg, err := ioutil.ReadFile(swaggerURL)
if err != nil {
log.Fatalf("Failed to load swagger file: %v", err)
}
gistURL := createGist(swg)
var only string
if len(os.Args) > 1 && os.Args[1] != "" {
only = os.Args[1]
}
var languages []string
if only != "" {
languages = append(languages, only)
} else {
// Download available languages from swagger generator api
languages = getLanguages()
}
for _, language := range languages {
var skipFiles []string
tmpDir := filepath.Join(rootTmpDir, language)
srcDir := filepath.Join(tmpDir, "src")
clientDir := filepath.Join(tmpDir, fmt.Sprintf("%s-client", language))
short := language
options := make(map[string]interface{})
var deploy [][]string
// Specfic language configurations
switch language {
case "go":
options["packageName"] = "functions"
options["packageVersion"] = version
case "ruby":
skipFiles = append(skipFiles, "#{gem_name}.gemspec")
deploy = append(deploy, []string{"gem", "build #{gem_name}.gemspec", "gem push #{gem_name}-#{version}.gem"})
options["gemName"] = "oracle_functions"
options["moduleName"] = "OracleFunctions"
options["gemVersion"] = version
options["gemHomepage"] = "https://github.com/treeder/functions_ruby"
options["gemSummary"] = "Ruby gem for Oracle Functions"
options["gemDescription"] = "Ruby gem for Oracle Functions."
options["gemAuthorEmail"] = "treeder@gmail.com"
case "javascript":
short = "js"
options["projectName"] = "oracle_functions"
deploy = append(deploy, []string{"npm", "publish"})
default:
continue
}
log.Printf("Generating `%s` client...\n", language)
err = os.MkdirAll(clientDir, 0777)
if err != nil {
log.Printf("Failed to create temporary directory for %s client. Skipping...", language)
}
// Generate client
if language == "go" {
err := genSwaggerClient(clientDir)
if err != nil {
log.Printf("Failed to (swagger-go) generated %s client. Skipping...", language)
continue
}
} else {
gen, err := generateClient(gistURL, language, options)
if err != nil {
log.Printf("Failed to generated %s client. Skipping...", language)
continue
}
// Download generated client
log.Printf("Downloading `%s` client...\n", language)
gf, err := getFile(strings.Replace(gen.Link, "https", "http", 1))
if err != nil {
log.Printf("Failed to download generated %s client. Skipping...", language)
}
ioutil.WriteFile(filepath.Join(tmpDir, "gen.zip"), gf, 0777)
// Unzip
log.Printf("Unzipping `%s` client...\n", language)
exec.Command("unzip", "-o", filepath.Join(tmpDir, "gen.zip"), "-d", tmpDir).Run()
os.Remove(filepath.Join(tmpDir, "gen.zip"))
}
branch := fmt.Sprintf("update-version-%s", version)
log.Printf("Cloning previous `%s` source...\n", language)
exec.Command("git", "clone", fmt.Sprintf("git@github.com:funcy/functions_%s.git", short), srcDir).Run()
// Skip language specific files
for _, skip := range skipFiles {
os.Remove(filepath.Join(tmpDir, clientDir, skip))
}
// Copying new client
log.Printf("Copying new `%s` client to src directory\n", language)
// Only solution I found
filepath.Walk(clientDir, func(path string, info os.FileInfo, err error) error {
if path == clientDir {
return nil
}
exec.Command("cp", "-r", path, srcDir).Run()
if info.IsDir() {
return filepath.SkipDir
}
return nil
})
f, err := os.OpenFile(filepath.Join(srcDir, "VERSION"), os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
log.Printf("Failed to save new `%s` VERSION file. Skipping...", language)
continue
}
f.WriteString(version)
f.Close()
os.Chdir(srcDir)
exec.Command("git", "checkout", "-b", branch).Run()
exec.Command("git", "add", ".").Run()
exec.Command("git", "commit", "-am", fmt.Sprintf("Updated to API version %s", version)).Run()
log.Printf("Pushing new `%s` client\n", language)
r := exec.Command("git", "push", "origin", branch).Run()
if r != nil && r.Error() != "" {
log.Printf("Failed to push new version: %s\n", r.Error())
break
}
log.Printf("Releasing new `%s` client\n", language)
for _, d := range deploy {
exec.Command(d[0], d[1])
}
log.Printf("Updated `%s` client to `%s` \n", language, version)
os.Chdir(cwd)
}
}
type generatedClient struct {
Link string `json:"link"`
}
func generateClient(url, lang string, options map[string]interface{}) (gc generatedClient, err error) {
payload := map[string]interface{}{
"swaggerUrl": url,
"options": options,
}
data, err := json.Marshal(payload)
if err != nil {
return
}
resp, err := http.Post(fmt.Sprintf("http://generator.swagger.io/api/gen/clients/%s", lang), "application/json", bytes.NewBuffer(data))
if err != nil {
return
}
result, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
err = json.Unmarshal(result, &gc)
if err != nil {
return
}
return
}
func getFile(url string) ([]byte, error) {
resp, err := http.Get(url)
if err != nil {
return nil, err
}
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return data, nil
}
func getLanguages() (langs []string) {
data, err := getFile("http://generator.swagger.io/api/gen/clients")
if err != nil {
log.Fatalf("Failed to load swagger languages: %v", err)
os.Exit(-1)
}
err = json.Unmarshal(data, &langs)
if err != nil {
log.Fatalf("Failed to load swagger languages: %v", err)
os.Exit(-1)
}
return
}
type GistFile struct {
Content string `json:"content"`
}
type Gist struct {
Description string `json:"description"`
Public bool `json:"public"`
Files map[string]GistFile `json:"files"`
}
type GistResponse struct {
Files map[string]struct {
RawURL string `json:"raw_url"`
} `json:"files"`
}
func createGist(b []byte) string {
var responseObj GistResponse
gist := Gist{
"",
false,
map[string]GistFile{
"swaggerSpec": {string(b)},
},
}
b, err := json.Marshal(gist)
if err != nil {
log.Fatal("JSON Error: ", err)
}
br := bytes.NewBuffer(b)
resp, err := http.Post("https://api.github.com/gists", "application/json", br)
if err != nil {
log.Fatal("HTTP Error: ", err)
}
err = json.NewDecoder(resp.Body).Decode(&responseObj)
if err != nil {
log.Fatal("Response JSON Error: ", err)
}
return responseObj.Files["swaggerSpec"].RawURL
}
const (
goSwaggerImage = "quay.io/goswagger/swagger"
)
func genSwaggerClient(target string) error {
u, err := user.Current()
if err != nil {
return err
}
cmd := exec.Command("docker", "run", "--rm", "-u", fmt.Sprintf("%s:%s", u.Uid, u.Gid), "-v", fmt.Sprintf("%s/%s:/go/src/github.com/funcy/functions_go", cwd, target), "-v", fmt.Sprintf("%s/%s:/go/swagger.spec", cwd, swaggerURL), "-w", "/go/src", "quay.io/goswagger/swagger", "generate", "client", "-f", "/go/swagger.spec", "-t", "github.com/funcy/functions_go", "-A", "functions")
d, err := cmd.CombinedOutput()
if err != nil {
log.Printf("Error running go-swagger: %s\n", d)
return err
}
return nil
}

View File

@@ -9,6 +9,7 @@ If you are a developer using Fn through the API, this section is for you.
* [Writing functions](writing.md)
* [fn (CLI Tool)](https://github.com/fnproject/cli/blob/master/README.md)
* [Function file (func.yaml)](function-file.md)
* [Client Libraries](developers/clients.md)
* [Packaging functions](packaging.md)
* [Open Function Format](function-format.md)
* API Reference (coming soon)

View File

@@ -0,0 +1,17 @@
# Client Libraries
## Language Wrappers to help writing functions
* [Java](https://github.com/fnproject/fn-java-fdk)
## Clients for the API
* [Go](https://github.com/fnproject/fn_go)
* [Java](https://github.com/fnproject/fn_java)
* [Ruby](https://github.com/fnproject/fn_ruby)
* [JavaScript](https://github.com/fnproject/fn_js)
* [Python](https://github.com/fnproject/fn_python)
* [PHP](https://github.com/fnproject/fn_php)
* [Elixir](https://github.com/fnproject/fn_elixir)
If we're missing your language, please create an issue and we'll try to get it made.

View File

@@ -1,12 +1,8 @@
# This is the Oracle Functions API spec
# If you make changes here, remember to run `go generate` in api/models/ and
# api/server to make sure you use the changes.
swagger: '2.0'
info:
title: Oracle Functions
title: fn
description: The open source serverless platform.
version: "0.1.37"
version: "0.2.0"
# the domain of the service
host: "127.0.0.1:8080"
# array of all schemes that your API supports

View File

@@ -4,8 +4,6 @@ This will give you the basic overview of writing base level functions. You can a
abstractions that make it easier such as [lambda](lambda/README.md).
Also, for complete examples in various languages, see the [examples directory](/examples).
We have language libraries for [Go](https://github.com/funcy/functions_go), [Javascript](https://github.com/treeder/functions_js) and
[Ruby](https://github.com/treeder/functions_ruby).
## Code

BIN
fn Executable file

Binary file not shown.

4
glide.lock generated
View File

@@ -170,8 +170,8 @@ imports:
- name: github.com/fsnotify/fsnotify
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/fsouza/go-dockerclient
version: 98edf3edfae6a6500fecc69d2bcccf1302544004
- name: github.com/funcy/functions_go
version: 75772940379e725b5aae213e570f9dcd751951cb
- name: github.com/fnproject/fn_go
version: e046aa4ca1f1028a04fc51395297ff07515cb0b6
subpackages:
- client

View File

@@ -4,8 +4,8 @@ excludeDirs:
import:
- package: golang.org/x/crypto/pkcs12
version: master
- package: github.com/funcy/functions_go
version: ^0.1.35
- package: github.com/fnproject/fn_go
version: ^0.2.0
subpackages:
- models
- package: github.com/sirupsen/logrus

View File

@@ -6,9 +6,9 @@ import (
"testing"
"time"
"github.com/funcy/functions_go/client"
"github.com/funcy/functions_go/client/apps"
"github.com/funcy/functions_go/models"
"github.com/fnproject/fn_go/client"
"github.com/fnproject/fn_go/client/apps"
"github.com/fnproject/fn_go/models"
)
func CheckAppResponseError(t *testing.T, e error) {
@@ -44,7 +44,7 @@ func CheckAppResponseError(t *testing.T, e error) {
}
}
func CreateAppNoAssert(ctx context.Context, fnclient *client.Functions, appName string, config map[string]string) (*apps.PostAppsOK, error) {
func CreateAppNoAssert(ctx context.Context, fnclient *client.Fn, appName string, config map[string]string) (*apps.PostAppsOK, error) {
cfg := &apps.PostAppsParams{
Body: &models.AppWrapper{
App: &models.App{
@@ -66,7 +66,7 @@ func CreateAppNoAssert(ctx context.Context, fnclient *client.Functions, appName
return ok, err
}
func CreateApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string, config map[string]string) {
func CreateApp(t *testing.T, ctx context.Context, fnclient *client.Fn, appName string, config map[string]string) {
appPayload, err := CreateAppNoAssert(ctx, fnclient, appName, config)
CheckAppResponseError(t, err)
if !strings.Contains(appName, appPayload.Payload.App.Name) {
@@ -75,7 +75,7 @@ func CreateApp(t *testing.T, ctx context.Context, fnclient *client.Functions, ap
}
}
func CreateUpdateApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string, config map[string]string) *apps.PatchAppsAppOK {
func CreateUpdateApp(t *testing.T, ctx context.Context, fnclient *client.Fn, appName string, config map[string]string) *apps.PatchAppsAppOK {
CreateApp(t, ctx, fnclient, appName, map[string]string{"A": "a"})
cfg := &apps.PatchAppsAppParams{
App: appName,
@@ -93,7 +93,7 @@ func CreateUpdateApp(t *testing.T, ctx context.Context, fnclient *client.Functio
return appPayload
}
func DeleteApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string) {
func DeleteApp(t *testing.T, ctx context.Context, fnclient *client.Fn, appName string) {
cfg := &apps.DeleteAppsAppParams{
App: appName,
Context: ctx,
@@ -103,7 +103,7 @@ func DeleteApp(t *testing.T, ctx context.Context, fnclient *client.Functions, ap
CheckAppResponseError(t, err)
}
func GetApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string) *models.App {
func GetApp(t *testing.T, ctx context.Context, fnclient *client.Fn, appName string) *models.App {
cfg := &apps.GetAppsAppParams{
App: appName,
Context: ctx,
@@ -114,7 +114,7 @@ func GetApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appNa
return app.Payload.App
}
func DeleteAppNoT(ctx context.Context, fnclient *client.Functions, appName string) {
func DeleteAppNoT(ctx context.Context, fnclient *client.Fn, appName string) {
cfg := &apps.DeleteAppsAppParams{
App: appName,
Context: ctx,

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/funcy/functions_go/client/apps"
"github.com/fnproject/fn_go/client/apps"
)
func TestApps(t *testing.T) {

View File

@@ -7,7 +7,7 @@ import (
"testing"
"time"
"github.com/funcy/functions_go/client/call"
"github.com/fnproject/fn_go/client/call"
)
func TestCalls(t *testing.T) {
@@ -78,21 +78,15 @@ func TestCalls(t *testing.T) {
}
u.Path = path.Join(u.Path, "r", s.AppName, s.RoutePath)
callID := CallAsync(t, u, &bytes.Buffer{})
time.Sleep(time.Second * 5)
cfg := &call.GetCallsCallParams{
Call: callID,
Context: s.Context,
}
cfg.WithTimeout(time.Second * 60)
_, err := s.Client.Call.GetAppsAppCalls(&call.GetAppsAppCallsParams{
App: s.AppName,
Route: &s.RoutePath,
})
if err != nil {
switch err.(type) {
case *call.GetCallsCallNotFound:
msg := err.(*call.GetCallsCallNotFound).Payload.Error.Message
case *call.GetAppsAppCallsCallNotFound:
msg := err.(*call.GetAppsAppCallsCallNotFound).Payload.Error.Message
t.Errorf("Unexpected error occurred: %v.", msg)
}
}

View File

@@ -10,8 +10,8 @@ import (
"testing"
"time"
"github.com/funcy/functions_go/client/call"
"github.com/funcy/functions_go/client/operations"
"github.com/fnproject/fn_go/client/call"
"github.com/fnproject/fn_go/client/operations"
)
type ErrMsg struct {
@@ -165,8 +165,8 @@ func TestRouteExecutions(t *testing.T) {
callResponse, err := s.Client.Call.GetAppsAppCallsCall(cfg)
if err != nil {
switch err.(type) {
case *call.GetCallsCallNotFound:
msg := err.(*call.GetCallsCallNotFound).Payload.Error.Message
case *call.GetAppsAppCallsCallNotFound:
msg := err.(*call.GetAppsAppCallsCallNotFound).Payload.Error.Message
t.Errorf("Unexpected error occurred: %v.", msg)
}
}

View File

@@ -4,9 +4,9 @@ import (
"context"
"testing"
"github.com/funcy/functions_go/client"
"github.com/funcy/functions_go/client/routes"
"github.com/funcy/functions_go/models"
"github.com/fnproject/fn_go/client"
"github.com/fnproject/fn_go/client/routes"
"github.com/fnproject/fn_go/models"
)
func CheckRouteResponseError(t *testing.T, e error) {
@@ -89,7 +89,7 @@ func assertRouteFields(t *testing.T, routeObject *models.Route, path, image, rou
}
func createRoute(ctx context.Context, fnclient *client.Functions, appName, image, routePath, routeType string, routeConfig map[string]string, headers map[string][]string) (*routes.PostAppsAppRoutesOK, error) {
func createRoute(ctx context.Context, fnclient *client.Fn, appName, image, routePath, routeType string, routeConfig map[string]string, headers map[string][]string) (*routes.PostAppsAppRoutesOK, error) {
cfg := &routes.PostAppsAppRoutesParams{
App: appName,
Body: &models.RouteWrapper{
@@ -118,14 +118,14 @@ func createRoute(ctx context.Context, fnclient *client.Functions, appName, image
}
func CreateRoute(t *testing.T, ctx context.Context, fnclient *client.Functions, appName, routePath, image, routeType, routeFormat string, routeConfig map[string]string, headers map[string][]string) {
func CreateRoute(t *testing.T, ctx context.Context, fnclient *client.Fn, appName, routePath, image, routeType, routeFormat string, routeConfig map[string]string, headers map[string][]string) {
routeResponse, err := createRoute(ctx, fnclient, appName, image, routePath, routeType, routeConfig, headers)
CheckRouteResponseError(t, err)
assertRouteFields(t, routeResponse.Payload.Route, routePath, image, routeType, routeFormat)
}
func deleteRoute(ctx context.Context, fnclient *client.Functions, appName, routePath string) (*routes.DeleteAppsAppRoutesRouteOK, error) {
func deleteRoute(ctx context.Context, fnclient *client.Fn, appName, routePath string) (*routes.DeleteAppsAppRoutesRouteOK, error) {
cfg := &routes.DeleteAppsAppRoutesRouteParams{
App: appName,
Route: routePath,
@@ -135,12 +135,12 @@ func deleteRoute(ctx context.Context, fnclient *client.Functions, appName, route
return fnclient.Routes.DeleteAppsAppRoutesRoute(cfg)
}
func DeleteRoute(t *testing.T, ctx context.Context, fnclient *client.Functions, appName, routePath string) {
func DeleteRoute(t *testing.T, ctx context.Context, fnclient *client.Fn, appName, routePath string) {
_, err := deleteRoute(ctx, fnclient, appName, routePath)
CheckRouteResponseError(t, err)
}
func ListRoutes(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string) []*models.Route {
func ListRoutes(t *testing.T, ctx context.Context, fnclient *client.Fn, appName string) []*models.Route {
cfg := &routes.GetAppsAppRoutesParams{
App: appName,
Context: ctx,
@@ -151,7 +151,7 @@ func ListRoutes(t *testing.T, ctx context.Context, fnclient *client.Functions, a
return routesResponse.Payload.Routes
}
func GetRoute(t *testing.T, ctx context.Context, fnclient *client.Functions, appName, routePath string) *models.Route {
func GetRoute(t *testing.T, ctx context.Context, fnclient *client.Fn, appName, routePath string) *models.Route {
cfg := &routes.GetAppsAppRoutesRouteParams{
App: appName,
Route: routePath,
@@ -163,7 +163,7 @@ func GetRoute(t *testing.T, ctx context.Context, fnclient *client.Functions, app
return routeResponse.Payload.Route
}
func UpdateRoute(t *testing.T, ctx context.Context, fnclient *client.Functions, appName, routePath, image, routeType, format string, memory uint64, routeConfig map[string]string, headers map[string][]string, newRoutePath string) (*routes.PatchAppsAppRoutesRouteOK, error) {
func UpdateRoute(t *testing.T, ctx context.Context, fnclient *client.Fn, appName, routePath, image, routeType, format string, memory uint64, routeConfig map[string]string, headers map[string][]string, newRoutePath string) (*routes.PatchAppsAppRoutesRouteOK, error) {
routeObject := GetRoute(t, ctx, fnclient, appName, routePath)
if routeObject.Config == nil {
@@ -231,7 +231,7 @@ func assertContainsRoute(routeModels []*models.Route, expectedRoute string) bool
return false
}
func DeployRoute(t *testing.T, ctx context.Context, fnclient *client.Functions, appName, routePath, image, routeType, routeFormat string, routeConfig map[string]string, headers map[string][]string) *models.Route {
func DeployRoute(t *testing.T, ctx context.Context, fnclient *client.Fn, appName, routePath, image, routeType, routeFormat string, routeConfig map[string]string, headers map[string][]string) *models.Route {
cfg := &routes.PutAppsAppRoutesRouteParams{
App: appName,
Context: ctx,

View File

@@ -5,7 +5,7 @@ import (
"testing"
"github.com/fnproject/fn/api/id"
"github.com/funcy/functions_go/models"
"github.com/fnproject/fn_go/models"
)
func TestRoutes(t *testing.T) {

View File

@@ -17,7 +17,7 @@ import (
"net/url"
"os"
"github.com/funcy/functions_go/client"
"github.com/fnproject/fn_go/client"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/spf13/viper"
@@ -38,7 +38,7 @@ func Host() string {
return u.Host
}
func APIClient() *client.Functions {
func APIClient() *client.Fn {
transport := httptransport.New(Host(), "/v1", []string{"http"})
if os.Getenv("FN_TOKEN") != "" {
transport.DefaultAuthentication = httptransport.BearerToken(os.Getenv("FN_TOKEN"))
@@ -100,7 +100,7 @@ func getServerWithCancel() (*server.Server, context.CancelFunc) {
type SuiteSetup struct {
Context context.Context
Client *client.Functions
Client *client.Fn
AppName string
RoutePath string
Image string

10347
tree.txt Normal file

File diff suppressed because it is too large Load Diff

14
vendor/github.com/fnproject/fn_go/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,14 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

201
vendor/github.com/fnproject/fn_go/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

1
vendor/github.com/fnproject/fn_go/VERSION generated vendored Normal file
View File

@@ -0,0 +1 @@
0.2.0

View File

@@ -0,0 +1,180 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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 apps API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for apps API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
DeleteAppsApp deletes an app
Delete an app.
*/
func (a *Client) DeleteAppsApp(params *DeleteAppsAppParams) (*DeleteAppsAppOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAppsAppParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteAppsApp",
Method: "DELETE",
PathPattern: "/apps/{app}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteAppsAppReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteAppsAppOK), nil
}
/*
GetApps gets all app names
Get a list of all the apps in the system.
*/
func (a *Client) GetApps(params *GetAppsParams) (*GetAppsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetApps",
Method: "GET",
PathPattern: "/apps",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsOK), nil
}
/*
GetAppsApp gets information for a app
This gives more details about a app, such as statistics.
*/
func (a *Client) GetAppsApp(params *GetAppsAppParams) (*GetAppsAppOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsAppParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsApp",
Method: "GET",
PathPattern: "/apps/{app}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsAppReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsAppOK), nil
}
/*
PatchAppsApp updates an app
You can set app level settings here.
*/
func (a *Client) PatchAppsApp(params *PatchAppsAppParams) (*PatchAppsAppOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAppsAppParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PatchAppsApp",
Method: "PATCH",
PathPattern: "/apps/{app}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PatchAppsAppReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PatchAppsAppOK), nil
}
/*
PostApps posts new app
Insert a new app
*/
func (a *Client) PostApps(params *PostAppsParams) (*PostAppsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAppsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PostApps",
Method: "POST",
PathPattern: "/apps",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PostAppsReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PostAppsOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,137 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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"
)
// NewDeleteAppsAppParams creates a new DeleteAppsAppParams object
// with the default values initialized.
func NewDeleteAppsAppParams() *DeleteAppsAppParams {
var ()
return &DeleteAppsAppParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAppsAppParamsWithTimeout creates a new DeleteAppsAppParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteAppsAppParamsWithTimeout(timeout time.Duration) *DeleteAppsAppParams {
var ()
return &DeleteAppsAppParams{
timeout: timeout,
}
}
// NewDeleteAppsAppParamsWithContext creates a new DeleteAppsAppParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteAppsAppParamsWithContext(ctx context.Context) *DeleteAppsAppParams {
var ()
return &DeleteAppsAppParams{
Context: ctx,
}
}
// NewDeleteAppsAppParamsWithHTTPClient creates a new DeleteAppsAppParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteAppsAppParamsWithHTTPClient(client *http.Client) *DeleteAppsAppParams {
var ()
return &DeleteAppsAppParams{
HTTPClient: client,
}
}
/*DeleteAppsAppParams contains all the parameters to send to the API endpoint
for the delete apps app operation typically these are written to a http.Request
*/
type DeleteAppsAppParams struct {
/*App
Name of the app.
*/
App string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete apps app params
func (o *DeleteAppsAppParams) WithTimeout(timeout time.Duration) *DeleteAppsAppParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete apps app params
func (o *DeleteAppsAppParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete apps app params
func (o *DeleteAppsAppParams) WithContext(ctx context.Context) *DeleteAppsAppParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete apps app params
func (o *DeleteAppsAppParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete apps app params
func (o *DeleteAppsAppParams) WithHTTPClient(client *http.Client) *DeleteAppsAppParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete apps app params
func (o *DeleteAppsAppParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the delete apps app params
func (o *DeleteAppsAppParams) WithApp(app string) *DeleteAppsAppParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the delete apps app params
func (o *DeleteAppsAppParams) SetApp(app string) {
o.App = app
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAppsAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,140 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// DeleteAppsAppReader is a Reader for the DeleteAppsApp structure.
type DeleteAppsAppReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAppsAppReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteAppsAppOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteAppsAppNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewDeleteAppsAppDefault(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
}
}
// NewDeleteAppsAppOK creates a DeleteAppsAppOK with default headers values
func NewDeleteAppsAppOK() *DeleteAppsAppOK {
return &DeleteAppsAppOK{}
}
/*DeleteAppsAppOK handles this case with default header values.
Apps successfully deleted.
*/
type DeleteAppsAppOK struct {
}
func (o *DeleteAppsAppOK) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}][%d] deleteAppsAppOK ", 200)
}
func (o *DeleteAppsAppOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAppsAppNotFound creates a DeleteAppsAppNotFound with default headers values
func NewDeleteAppsAppNotFound() *DeleteAppsAppNotFound {
return &DeleteAppsAppNotFound{}
}
/*DeleteAppsAppNotFound handles this case with default header values.
App does not exist.
*/
type DeleteAppsAppNotFound struct {
Payload *models.Error
}
func (o *DeleteAppsAppNotFound) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}][%d] deleteAppsAppNotFound %+v", 404, o.Payload)
}
func (o *DeleteAppsAppNotFound) 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
}
// NewDeleteAppsAppDefault creates a DeleteAppsAppDefault with default headers values
func NewDeleteAppsAppDefault(code int) *DeleteAppsAppDefault {
return &DeleteAppsAppDefault{
_statusCode: code,
}
}
/*DeleteAppsAppDefault handles this case with default header values.
Unexpected error
*/
type DeleteAppsAppDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the delete apps app default response
func (o *DeleteAppsAppDefault) Code() int {
return o._statusCode
}
func (o *DeleteAppsAppDefault) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}][%d] DeleteAppsApp default %+v", o._statusCode, o.Payload)
}
func (o *DeleteAppsAppDefault) 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,137 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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"
)
// NewGetAppsAppParams creates a new GetAppsAppParams object
// with the default values initialized.
func NewGetAppsAppParams() *GetAppsAppParams {
var ()
return &GetAppsAppParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAppsAppParamsWithTimeout creates a new GetAppsAppParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetAppsAppParamsWithTimeout(timeout time.Duration) *GetAppsAppParams {
var ()
return &GetAppsAppParams{
timeout: timeout,
}
}
// NewGetAppsAppParamsWithContext creates a new GetAppsAppParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetAppsAppParamsWithContext(ctx context.Context) *GetAppsAppParams {
var ()
return &GetAppsAppParams{
Context: ctx,
}
}
// NewGetAppsAppParamsWithHTTPClient creates a new GetAppsAppParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetAppsAppParamsWithHTTPClient(client *http.Client) *GetAppsAppParams {
var ()
return &GetAppsAppParams{
HTTPClient: client,
}
}
/*GetAppsAppParams contains all the parameters to send to the API endpoint
for the get apps app operation typically these are written to a http.Request
*/
type GetAppsAppParams struct {
/*App
name of the app.
*/
App string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps app params
func (o *GetAppsAppParams) WithTimeout(timeout time.Duration) *GetAppsAppParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps app params
func (o *GetAppsAppParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps app params
func (o *GetAppsAppParams) WithContext(ctx context.Context) *GetAppsAppParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps app params
func (o *GetAppsAppParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps app params
func (o *GetAppsAppParams) WithHTTPClient(client *http.Client) *GetAppsAppParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps app params
func (o *GetAppsAppParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the get apps app params
func (o *GetAppsAppParams) WithApp(app string) *GetAppsAppParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the get apps app params
func (o *GetAppsAppParams) SetApp(app string) {
o.App = app
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,148 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// GetAppsAppReader is a Reader for the GetAppsApp structure.
type GetAppsAppReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsAppReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsAppOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetAppsAppNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetAppsAppDefault(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
}
}
// NewGetAppsAppOK creates a GetAppsAppOK with default headers values
func NewGetAppsAppOK() *GetAppsAppOK {
return &GetAppsAppOK{}
}
/*GetAppsAppOK handles this case with default header values.
App details and stats.
*/
type GetAppsAppOK struct {
Payload *models.AppWrapper
}
func (o *GetAppsAppOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}][%d] getAppsAppOK %+v", 200, o.Payload)
}
func (o *GetAppsAppOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.AppWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAppsAppNotFound creates a GetAppsAppNotFound with default headers values
func NewGetAppsAppNotFound() *GetAppsAppNotFound {
return &GetAppsAppNotFound{}
}
/*GetAppsAppNotFound handles this case with default header values.
App does not exist.
*/
type GetAppsAppNotFound struct {
Payload *models.Error
}
func (o *GetAppsAppNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}][%d] getAppsAppNotFound %+v", 404, o.Payload)
}
func (o *GetAppsAppNotFound) 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
}
// NewGetAppsAppDefault creates a GetAppsAppDefault with default headers values
func NewGetAppsAppDefault(code int) *GetAppsAppDefault {
return &GetAppsAppDefault{
_statusCode: code,
}
}
/*GetAppsAppDefault handles this case with default header values.
Unexpected error
*/
type GetAppsAppDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get apps app default response
func (o *GetAppsAppDefault) Code() int {
return o._statusCode
}
func (o *GetAppsAppDefault) Error() string {
return fmt.Sprintf("[GET /apps/{app}][%d] GetAppsApp default %+v", o._statusCode, o.Payload)
}
func (o *GetAppsAppDefault) 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,114 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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"
)
// NewGetAppsParams creates a new GetAppsParams object
// with the default values initialized.
func NewGetAppsParams() *GetAppsParams {
return &GetAppsParams{
timeout: cr.DefaultTimeout,
}
}
// 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 {
return &GetAppsParams{
timeout: timeout,
}
}
// 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 {
return &GetAppsParams{
Context: ctx,
}
}
// 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 {
return &GetAppsParams{
HTTPClient: client,
}
}
/*GetAppsParams contains all the parameters to send to the API endpoint
for the get apps operation typically these are written to a http.Request
*/
type GetAppsParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps params
func (o *GetAppsParams) WithTimeout(timeout time.Duration) *GetAppsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps params
func (o *GetAppsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps params
func (o *GetAppsParams) WithContext(ctx context.Context) *GetAppsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps params
func (o *GetAppsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps params
func (o *GetAppsParams) WithHTTPClient(client *http.Client) *GetAppsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps params
func (o *GetAppsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,112 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// GetAppsReader is a Reader for the GetApps structure.
type GetAppsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewGetAppsDefault(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
}
}
// NewGetAppsOK creates a GetAppsOK with default headers values
func NewGetAppsOK() *GetAppsOK {
return &GetAppsOK{}
}
/*GetAppsOK handles this case with default header values.
List of apps.
*/
type GetAppsOK struct {
Payload *models.AppsWrapper
}
func (o *GetAppsOK) Error() string {
return fmt.Sprintf("[GET /apps][%d] getAppsOK %+v", 200, o.Payload)
}
func (o *GetAppsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.AppsWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAppsDefault creates a GetAppsDefault with default headers values
func NewGetAppsDefault(code int) *GetAppsDefault {
return &GetAppsDefault{
_statusCode: code,
}
}
/*GetAppsDefault handles this case with default header values.
Unexpected error
*/
type GetAppsDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get apps default response
func (o *GetAppsDefault) Code() int {
return o._statusCode
}
func (o *GetAppsDefault) Error() string {
return fmt.Sprintf("[GET /apps][%d] GetApps default %+v", o._statusCode, o.Payload)
}
func (o *GetAppsDefault) 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,163 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// NewPatchAppsAppParams creates a new PatchAppsAppParams object
// with the default values initialized.
func NewPatchAppsAppParams() *PatchAppsAppParams {
var ()
return &PatchAppsAppParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAppsAppParamsWithTimeout creates a new PatchAppsAppParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPatchAppsAppParamsWithTimeout(timeout time.Duration) *PatchAppsAppParams {
var ()
return &PatchAppsAppParams{
timeout: timeout,
}
}
// NewPatchAppsAppParamsWithContext creates a new PatchAppsAppParams object
// with the default values initialized, and the ability to set a context for a request
func NewPatchAppsAppParamsWithContext(ctx context.Context) *PatchAppsAppParams {
var ()
return &PatchAppsAppParams{
Context: ctx,
}
}
// NewPatchAppsAppParamsWithHTTPClient creates a new PatchAppsAppParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPatchAppsAppParamsWithHTTPClient(client *http.Client) *PatchAppsAppParams {
var ()
return &PatchAppsAppParams{
HTTPClient: client,
}
}
/*PatchAppsAppParams contains all the parameters to send to the API endpoint
for the patch apps app operation typically these are written to a http.Request
*/
type PatchAppsAppParams struct {
/*App
name of the app.
*/
App string
/*Body
App to post.
*/
Body *models.AppWrapper
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the patch apps app params
func (o *PatchAppsAppParams) WithTimeout(timeout time.Duration) *PatchAppsAppParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch apps app params
func (o *PatchAppsAppParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch apps app params
func (o *PatchAppsAppParams) WithContext(ctx context.Context) *PatchAppsAppParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch apps app params
func (o *PatchAppsAppParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch apps app params
func (o *PatchAppsAppParams) WithHTTPClient(client *http.Client) *PatchAppsAppParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch apps app params
func (o *PatchAppsAppParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the patch apps app params
func (o *PatchAppsAppParams) WithApp(app string) *PatchAppsAppParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the patch apps app params
func (o *PatchAppsAppParams) SetApp(app string) {
o.App = app
}
// WithBody adds the body to the patch apps app params
func (o *PatchAppsAppParams) WithBody(body *models.AppWrapper) *PatchAppsAppParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the patch apps app params
func (o *PatchAppsAppParams) SetBody(body *models.AppWrapper) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAppsAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if o.Body == nil {
o.Body = new(models.AppWrapper)
}
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,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// PatchAppsAppReader is a Reader for the PatchAppsApp structure.
type PatchAppsAppReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAppsAppReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAppsAppOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPatchAppsAppBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPatchAppsAppNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewPatchAppsAppDefault(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
}
}
// NewPatchAppsAppOK creates a PatchAppsAppOK with default headers values
func NewPatchAppsAppOK() *PatchAppsAppOK {
return &PatchAppsAppOK{}
}
/*PatchAppsAppOK handles this case with default header values.
App details and stats.
*/
type PatchAppsAppOK struct {
Payload *models.AppWrapper
}
func (o *PatchAppsAppOK) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}][%d] patchAppsAppOK %+v", 200, o.Payload)
}
func (o *PatchAppsAppOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.AppWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPatchAppsAppBadRequest creates a PatchAppsAppBadRequest with default headers values
func NewPatchAppsAppBadRequest() *PatchAppsAppBadRequest {
return &PatchAppsAppBadRequest{}
}
/*PatchAppsAppBadRequest handles this case with default header values.
Parameters are missing or invalid.
*/
type PatchAppsAppBadRequest struct {
Payload *models.Error
}
func (o *PatchAppsAppBadRequest) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}][%d] patchAppsAppBadRequest %+v", 400, o.Payload)
}
func (o *PatchAppsAppBadRequest) 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
}
// NewPatchAppsAppNotFound creates a PatchAppsAppNotFound with default headers values
func NewPatchAppsAppNotFound() *PatchAppsAppNotFound {
return &PatchAppsAppNotFound{}
}
/*PatchAppsAppNotFound handles this case with default header values.
App does not exist.
*/
type PatchAppsAppNotFound struct {
Payload *models.Error
}
func (o *PatchAppsAppNotFound) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}][%d] patchAppsAppNotFound %+v", 404, o.Payload)
}
func (o *PatchAppsAppNotFound) 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
}
// NewPatchAppsAppDefault creates a PatchAppsAppDefault with default headers values
func NewPatchAppsAppDefault(code int) *PatchAppsAppDefault {
return &PatchAppsAppDefault{
_statusCode: code,
}
}
/*PatchAppsAppDefault handles this case with default header values.
Unexpected error
*/
type PatchAppsAppDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the patch apps app default response
func (o *PatchAppsAppDefault) Code() int {
return o._statusCode
}
func (o *PatchAppsAppDefault) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}][%d] PatchAppsApp default %+v", o._statusCode, o.Payload)
}
func (o *PatchAppsAppDefault) 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 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// NewPostAppsParams creates a new PostAppsParams object
// with the default values initialized.
func NewPostAppsParams() *PostAppsParams {
var ()
return &PostAppsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAppsParamsWithTimeout creates a new PostAppsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPostAppsParamsWithTimeout(timeout time.Duration) *PostAppsParams {
var ()
return &PostAppsParams{
timeout: timeout,
}
}
// NewPostAppsParamsWithContext creates a new PostAppsParams object
// with the default values initialized, and the ability to set a context for a request
func NewPostAppsParamsWithContext(ctx context.Context) *PostAppsParams {
var ()
return &PostAppsParams{
Context: ctx,
}
}
// NewPostAppsParamsWithHTTPClient creates a new PostAppsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPostAppsParamsWithHTTPClient(client *http.Client) *PostAppsParams {
var ()
return &PostAppsParams{
HTTPClient: client,
}
}
/*PostAppsParams contains all the parameters to send to the API endpoint
for the post apps operation typically these are written to a http.Request
*/
type PostAppsParams struct {
/*Body
App to post.
*/
Body *models.AppWrapper
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the post apps params
func (o *PostAppsParams) WithTimeout(timeout time.Duration) *PostAppsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post apps params
func (o *PostAppsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post apps params
func (o *PostAppsParams) WithContext(ctx context.Context) *PostAppsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post apps params
func (o *PostAppsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post apps params
func (o *PostAppsParams) WithHTTPClient(client *http.Client) *PostAppsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post apps params
func (o *PostAppsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the post apps params
func (o *PostAppsParams) WithBody(body *models.AppWrapper) *PostAppsParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post apps params
func (o *PostAppsParams) SetBody(body *models.AppWrapper) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PostAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body == nil {
o.Body = new(models.AppWrapper)
}
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,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps
// 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/fnproject/fn_go/models"
)
// PostAppsReader is a Reader for the PostApps structure.
type PostAppsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAppsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAppsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPostAppsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewPostAppsConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewPostAppsDefault(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
}
}
// NewPostAppsOK creates a PostAppsOK with default headers values
func NewPostAppsOK() *PostAppsOK {
return &PostAppsOK{}
}
/*PostAppsOK handles this case with default header values.
App details and stats.
*/
type PostAppsOK struct {
Payload *models.AppWrapper
}
func (o *PostAppsOK) Error() string {
return fmt.Sprintf("[POST /apps][%d] postAppsOK %+v", 200, o.Payload)
}
func (o *PostAppsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.AppWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostAppsBadRequest creates a PostAppsBadRequest with default headers values
func NewPostAppsBadRequest() *PostAppsBadRequest {
return &PostAppsBadRequest{}
}
/*PostAppsBadRequest handles this case with default header values.
Parameters are missing or invalid.
*/
type PostAppsBadRequest struct {
Payload *models.Error
}
func (o *PostAppsBadRequest) Error() string {
return fmt.Sprintf("[POST /apps][%d] postAppsBadRequest %+v", 400, o.Payload)
}
func (o *PostAppsBadRequest) 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
}
// NewPostAppsConflict creates a PostAppsConflict with default headers values
func NewPostAppsConflict() *PostAppsConflict {
return &PostAppsConflict{}
}
/*PostAppsConflict handles this case with default header values.
App already exists.
*/
type PostAppsConflict struct {
Payload *models.Error
}
func (o *PostAppsConflict) Error() string {
return fmt.Sprintf("[POST /apps][%d] postAppsConflict %+v", 409, o.Payload)
}
func (o *PostAppsConflict) 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
}
// NewPostAppsDefault creates a PostAppsDefault with default headers values
func NewPostAppsDefault(code int) *PostAppsDefault {
return &PostAppsDefault{
_statusCode: code,
}
}
/*PostAppsDefault handles this case with default header values.
Unexpected error
*/
type PostAppsDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the post apps default response
func (o *PostAppsDefault) Code() int {
return o._statusCode
}
func (o *PostAppsDefault) Error() string {
return fmt.Sprintf("[POST /apps][%d] PostApps default %+v", o._statusCode, o.Payload)
}
func (o *PostAppsDefault) 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,90 @@
// Code generated by go-swagger; DO NOT EDIT.
package call
// 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 call API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for call API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
GetAppsAppCalls gets app bound calls
Get app-bound calls can filter to route-bound calls.
*/
func (a *Client) GetAppsAppCalls(params *GetAppsAppCallsParams) (*GetAppsAppCallsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsAppCallsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsAppCalls",
Method: "GET",
PathPattern: "/apps/{app}/calls",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsAppCallsReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsAppCallsOK), nil
}
/*
GetAppsAppCallsCall gets call information
Get call information
*/
func (a *Client) GetAppsAppCallsCall(params *GetAppsAppCallsCallParams) (*GetAppsAppCallsCallOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsAppCallsCallParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsAppCallsCall",
Method: "GET",
PathPattern: "/apps/{app}/calls/{call}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsAppCallsCallReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsAppCallsCallOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,158 @@
// Code generated by go-swagger; DO NOT EDIT.
package call
// 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"
)
// NewGetAppsAppCallsCallParams creates a new GetAppsAppCallsCallParams object
// with the default values initialized.
func NewGetAppsAppCallsCallParams() *GetAppsAppCallsCallParams {
var ()
return &GetAppsAppCallsCallParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAppsAppCallsCallParamsWithTimeout creates a new GetAppsAppCallsCallParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetAppsAppCallsCallParamsWithTimeout(timeout time.Duration) *GetAppsAppCallsCallParams {
var ()
return &GetAppsAppCallsCallParams{
timeout: timeout,
}
}
// NewGetAppsAppCallsCallParamsWithContext creates a new GetAppsAppCallsCallParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetAppsAppCallsCallParamsWithContext(ctx context.Context) *GetAppsAppCallsCallParams {
var ()
return &GetAppsAppCallsCallParams{
Context: ctx,
}
}
// NewGetAppsAppCallsCallParamsWithHTTPClient creates a new GetAppsAppCallsCallParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetAppsAppCallsCallParamsWithHTTPClient(client *http.Client) *GetAppsAppCallsCallParams {
var ()
return &GetAppsAppCallsCallParams{
HTTPClient: client,
}
}
/*GetAppsAppCallsCallParams contains all the parameters to send to the API endpoint
for the get apps app calls call operation typically these are written to a http.Request
*/
type GetAppsAppCallsCallParams struct {
/*App
app name
*/
App string
/*Call
Call ID.
*/
Call string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) WithTimeout(timeout time.Duration) *GetAppsAppCallsCallParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) WithContext(ctx context.Context) *GetAppsAppCallsCallParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) WithHTTPClient(client *http.Client) *GetAppsAppCallsCallParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) WithApp(app string) *GetAppsAppCallsCallParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) SetApp(app string) {
o.App = app
}
// WithCall adds the call to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) WithCall(call string) *GetAppsAppCallsCallParams {
o.SetCall(call)
return o
}
// SetCall adds the call to the get apps app calls call params
func (o *GetAppsAppCallsCallParams) SetCall(call string) {
o.Call = call
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsAppCallsCallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
// 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,103 @@
// Code generated by go-swagger; DO NOT EDIT.
package call
// 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/fnproject/fn_go/models"
)
// GetAppsAppCallsCallReader is a Reader for the GetAppsAppCallsCall structure.
type GetAppsAppCallsCallReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsAppCallsCallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsAppCallsCallOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetAppsAppCallsCallNotFound()
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())
}
}
// NewGetAppsAppCallsCallOK creates a GetAppsAppCallsCallOK with default headers values
func NewGetAppsAppCallsCallOK() *GetAppsAppCallsCallOK {
return &GetAppsAppCallsCallOK{}
}
/*GetAppsAppCallsCallOK handles this case with default header values.
Call found
*/
type GetAppsAppCallsCallOK struct {
Payload *models.CallWrapper
}
func (o *GetAppsAppCallsCallOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls/{call}][%d] getAppsAppCallsCallOK %+v", 200, o.Payload)
}
func (o *GetAppsAppCallsCallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.CallWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAppsAppCallsCallNotFound creates a GetAppsAppCallsCallNotFound with default headers values
func NewGetAppsAppCallsCallNotFound() *GetAppsAppCallsCallNotFound {
return &GetAppsAppCallsCallNotFound{}
}
/*GetAppsAppCallsCallNotFound handles this case with default header values.
Call not found.
*/
type GetAppsAppCallsCallNotFound struct {
Payload *models.Error
}
func (o *GetAppsAppCallsCallNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls/{call}][%d] getAppsAppCallsCallNotFound %+v", 404, o.Payload)
}
func (o *GetAppsAppCallsCallNotFound) 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,169 @@
// Code generated by go-swagger; DO NOT EDIT.
package call
// 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"
)
// NewGetAppsAppCallsParams creates a new GetAppsAppCallsParams object
// with the default values initialized.
func NewGetAppsAppCallsParams() *GetAppsAppCallsParams {
var ()
return &GetAppsAppCallsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAppsAppCallsParamsWithTimeout creates a new GetAppsAppCallsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetAppsAppCallsParamsWithTimeout(timeout time.Duration) *GetAppsAppCallsParams {
var ()
return &GetAppsAppCallsParams{
timeout: timeout,
}
}
// NewGetAppsAppCallsParamsWithContext creates a new GetAppsAppCallsParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetAppsAppCallsParamsWithContext(ctx context.Context) *GetAppsAppCallsParams {
var ()
return &GetAppsAppCallsParams{
Context: ctx,
}
}
// NewGetAppsAppCallsParamsWithHTTPClient creates a new GetAppsAppCallsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetAppsAppCallsParamsWithHTTPClient(client *http.Client) *GetAppsAppCallsParams {
var ()
return &GetAppsAppCallsParams{
HTTPClient: client,
}
}
/*GetAppsAppCallsParams contains all the parameters to send to the API endpoint
for the get apps app calls operation typically these are written to a http.Request
*/
type GetAppsAppCallsParams struct {
/*App
App name.
*/
App string
/*Route
App route.
*/
Route *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps app calls params
func (o *GetAppsAppCallsParams) WithTimeout(timeout time.Duration) *GetAppsAppCallsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps app calls params
func (o *GetAppsAppCallsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps app calls params
func (o *GetAppsAppCallsParams) WithContext(ctx context.Context) *GetAppsAppCallsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps app calls params
func (o *GetAppsAppCallsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps app calls params
func (o *GetAppsAppCallsParams) WithHTTPClient(client *http.Client) *GetAppsAppCallsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps app calls params
func (o *GetAppsAppCallsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the get apps app calls params
func (o *GetAppsAppCallsParams) WithApp(app string) *GetAppsAppCallsParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the get apps app calls params
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)
return o
}
// SetRoute adds the route to the get apps app calls params
func (o *GetAppsAppCallsParams) SetRoute(route *string) {
o.Route = route
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsAppCallsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if o.Route != nil {
// query param route
var qrRoute string
if o.Route != nil {
qrRoute = *o.Route
}
qRoute := qrRoute
if qRoute != "" {
if err := r.SetQueryParam("route", qRoute); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,103 @@
// Code generated by go-swagger; DO NOT EDIT.
package call
// 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/fnproject/fn_go/models"
)
// GetAppsAppCallsReader is a Reader for the GetAppsAppCalls structure.
type GetAppsAppCallsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsAppCallsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsAppCallsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetAppsAppCallsNotFound()
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())
}
}
// NewGetAppsAppCallsOK creates a GetAppsAppCallsOK with default headers values
func NewGetAppsAppCallsOK() *GetAppsAppCallsOK {
return &GetAppsAppCallsOK{}
}
/*GetAppsAppCallsOK handles this case with default header values.
Calls found
*/
type GetAppsAppCallsOK struct {
Payload *models.CallsWrapper
}
func (o *GetAppsAppCallsOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls][%d] getAppsAppCallsOK %+v", 200, o.Payload)
}
func (o *GetAppsAppCallsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.CallsWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAppsAppCallsNotFound creates a GetAppsAppCallsNotFound with default headers values
func NewGetAppsAppCallsNotFound() *GetAppsAppCallsNotFound {
return &GetAppsAppCallsNotFound{}
}
/*GetAppsAppCallsNotFound handles this case with default header values.
Calls not found.
*/
type GetAppsAppCallsNotFound struct {
Payload *models.Error
}
func (o *GetAppsAppCallsNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls][%d] getAppsAppCallsNotFound %+v", 404, o.Payload)
}
func (o *GetAppsAppCallsNotFound) 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
}

136
vendor/github.com/fnproject/fn_go/client/fn_client.go generated vendored Normal file
View File

@@ -0,0 +1,136 @@
// Code generated by go-swagger; DO NOT EDIT.
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/fnproject/fn_go/client/apps"
"github.com/fnproject/fn_go/client/call"
"github.com/fnproject/fn_go/client/operations"
"github.com/fnproject/fn_go/client/routes"
)
// Default fn HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "127.0.0.1:8080"
// DefaultBasePath is the default BasePath
// found in Meta (info) section of spec file
DefaultBasePath string = "/v1"
)
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http", "https"}
// NewHTTPClient creates a new fn HTTP client.
func NewHTTPClient(formats strfmt.Registry) *Fn {
return NewHTTPClientWithConfig(formats, nil)
}
// NewHTTPClientWithConfig creates a new fn HTTP client,
// using a customizable transport config.
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Fn {
// 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 fn client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Fn {
cli := new(Fn)
cli.Transport = transport
cli.Apps = apps.New(transport, formats)
cli.Call = call.New(transport, formats)
cli.Operations = operations.New(transport, formats)
cli.Routes = routes.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
}
// Fn is a client for fn
type Fn struct {
Apps *apps.Client
Call *call.Client
Operations *operations.Client
Routes *routes.Client
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *Fn) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Apps.SetTransport(transport)
c.Call.SetTransport(transport)
c.Operations.SetTransport(transport)
c.Routes.SetTransport(transport)
}

View File

@@ -0,0 +1,158 @@
// Code generated by go-swagger; DO NOT EDIT.
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"
)
// NewDeleteAppsAppCallsCallLogParams creates a new DeleteAppsAppCallsCallLogParams object
// with the default values initialized.
func NewDeleteAppsAppCallsCallLogParams() *DeleteAppsAppCallsCallLogParams {
var ()
return &DeleteAppsAppCallsCallLogParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAppsAppCallsCallLogParamsWithTimeout creates a new DeleteAppsAppCallsCallLogParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteAppsAppCallsCallLogParamsWithTimeout(timeout time.Duration) *DeleteAppsAppCallsCallLogParams {
var ()
return &DeleteAppsAppCallsCallLogParams{
timeout: timeout,
}
}
// NewDeleteAppsAppCallsCallLogParamsWithContext creates a new DeleteAppsAppCallsCallLogParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteAppsAppCallsCallLogParamsWithContext(ctx context.Context) *DeleteAppsAppCallsCallLogParams {
var ()
return &DeleteAppsAppCallsCallLogParams{
Context: ctx,
}
}
// NewDeleteAppsAppCallsCallLogParamsWithHTTPClient creates a new DeleteAppsAppCallsCallLogParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteAppsAppCallsCallLogParamsWithHTTPClient(client *http.Client) *DeleteAppsAppCallsCallLogParams {
var ()
return &DeleteAppsAppCallsCallLogParams{
HTTPClient: client,
}
}
/*DeleteAppsAppCallsCallLogParams contains all the parameters to send to the API endpoint
for the delete apps app calls call log operation typically these are written to a http.Request
*/
type DeleteAppsAppCallsCallLogParams struct {
/*App
App name.
*/
App string
/*Call
Call ID.
*/
Call string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) WithTimeout(timeout time.Duration) *DeleteAppsAppCallsCallLogParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) WithContext(ctx context.Context) *DeleteAppsAppCallsCallLogParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) WithHTTPClient(client *http.Client) *DeleteAppsAppCallsCallLogParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) WithApp(app string) *DeleteAppsAppCallsCallLogParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) SetApp(app string) {
o.App = app
}
// WithCall adds the call to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) WithCall(call string) *DeleteAppsAppCallsCallLogParams {
o.SetCall(call)
return o
}
// SetCall adds the call to the delete apps app calls call log params
func (o *DeleteAppsAppCallsCallLogParams) SetCall(call string) {
o.Call = call
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAppsAppCallsCallLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
// 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,140 @@
// Code generated by go-swagger; DO NOT EDIT.
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/fnproject/fn_go/models"
)
// DeleteAppsAppCallsCallLogReader is a Reader for the DeleteAppsAppCallsCallLog structure.
type DeleteAppsAppCallsCallLogReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAppsAppCallsCallLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 202:
result := NewDeleteAppsAppCallsCallLogAccepted()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteAppsAppCallsCallLogNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewDeleteAppsAppCallsCallLogDefault(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
}
}
// NewDeleteAppsAppCallsCallLogAccepted creates a DeleteAppsAppCallsCallLogAccepted with default headers values
func NewDeleteAppsAppCallsCallLogAccepted() *DeleteAppsAppCallsCallLogAccepted {
return &DeleteAppsAppCallsCallLogAccepted{}
}
/*DeleteAppsAppCallsCallLogAccepted handles this case with default header values.
Log delete request accepted
*/
type DeleteAppsAppCallsCallLogAccepted struct {
}
func (o *DeleteAppsAppCallsCallLogAccepted) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}/calls/{call}/log][%d] deleteAppsAppCallsCallLogAccepted ", 202)
}
func (o *DeleteAppsAppCallsCallLogAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAppsAppCallsCallLogNotFound creates a DeleteAppsAppCallsCallLogNotFound with default headers values
func NewDeleteAppsAppCallsCallLogNotFound() *DeleteAppsAppCallsCallLogNotFound {
return &DeleteAppsAppCallsCallLogNotFound{}
}
/*DeleteAppsAppCallsCallLogNotFound handles this case with default header values.
Does not exist.
*/
type DeleteAppsAppCallsCallLogNotFound struct {
Payload *models.Error
}
func (o *DeleteAppsAppCallsCallLogNotFound) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}/calls/{call}/log][%d] deleteAppsAppCallsCallLogNotFound %+v", 404, o.Payload)
}
func (o *DeleteAppsAppCallsCallLogNotFound) 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
}
// NewDeleteAppsAppCallsCallLogDefault creates a DeleteAppsAppCallsCallLogDefault with default headers values
func NewDeleteAppsAppCallsCallLogDefault(code int) *DeleteAppsAppCallsCallLogDefault {
return &DeleteAppsAppCallsCallLogDefault{
_statusCode: code,
}
}
/*DeleteAppsAppCallsCallLogDefault handles this case with default header values.
Unexpected error
*/
type DeleteAppsAppCallsCallLogDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the delete apps app calls call log default response
func (o *DeleteAppsAppCallsCallLogDefault) Code() int {
return o._statusCode
}
func (o *DeleteAppsAppCallsCallLogDefault) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}/calls/{call}/log][%d] DeleteAppsAppCallsCallLog default %+v", o._statusCode, o.Payload)
}
func (o *DeleteAppsAppCallsCallLogDefault) 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,158 @@
// Code generated by go-swagger; DO NOT EDIT.
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"
)
// NewGetAppsAppCallsCallLogParams creates a new GetAppsAppCallsCallLogParams object
// with the default values initialized.
func NewGetAppsAppCallsCallLogParams() *GetAppsAppCallsCallLogParams {
var ()
return &GetAppsAppCallsCallLogParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAppsAppCallsCallLogParamsWithTimeout creates a new GetAppsAppCallsCallLogParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetAppsAppCallsCallLogParamsWithTimeout(timeout time.Duration) *GetAppsAppCallsCallLogParams {
var ()
return &GetAppsAppCallsCallLogParams{
timeout: timeout,
}
}
// NewGetAppsAppCallsCallLogParamsWithContext creates a new GetAppsAppCallsCallLogParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetAppsAppCallsCallLogParamsWithContext(ctx context.Context) *GetAppsAppCallsCallLogParams {
var ()
return &GetAppsAppCallsCallLogParams{
Context: ctx,
}
}
// NewGetAppsAppCallsCallLogParamsWithHTTPClient creates a new GetAppsAppCallsCallLogParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetAppsAppCallsCallLogParamsWithHTTPClient(client *http.Client) *GetAppsAppCallsCallLogParams {
var ()
return &GetAppsAppCallsCallLogParams{
HTTPClient: client,
}
}
/*GetAppsAppCallsCallLogParams contains all the parameters to send to the API endpoint
for the get apps app calls call log operation typically these are written to a http.Request
*/
type GetAppsAppCallsCallLogParams struct {
/*App
App Name
*/
App string
/*Call
Call ID.
*/
Call string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) WithTimeout(timeout time.Duration) *GetAppsAppCallsCallLogParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) WithContext(ctx context.Context) *GetAppsAppCallsCallLogParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) WithHTTPClient(client *http.Client) *GetAppsAppCallsCallLogParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) WithApp(app string) *GetAppsAppCallsCallLogParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) SetApp(app string) {
o.App = app
}
// WithCall adds the call to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) WithCall(call string) *GetAppsAppCallsCallLogParams {
o.SetCall(call)
return o
}
// SetCall adds the call to the get apps app calls call log params
func (o *GetAppsAppCallsCallLogParams) SetCall(call string) {
o.Call = call
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsAppCallsCallLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
// 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,103 @@
// Code generated by go-swagger; DO NOT EDIT.
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/fnproject/fn_go/models"
)
// GetAppsAppCallsCallLogReader is a Reader for the GetAppsAppCallsCallLog structure.
type GetAppsAppCallsCallLogReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsAppCallsCallLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsAppCallsCallLogOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetAppsAppCallsCallLogNotFound()
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())
}
}
// NewGetAppsAppCallsCallLogOK creates a GetAppsAppCallsCallLogOK with default headers values
func NewGetAppsAppCallsCallLogOK() *GetAppsAppCallsCallLogOK {
return &GetAppsAppCallsCallLogOK{}
}
/*GetAppsAppCallsCallLogOK handles this case with default header values.
Log found
*/
type GetAppsAppCallsCallLogOK struct {
Payload *models.LogWrapper
}
func (o *GetAppsAppCallsCallLogOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls/{call}/log][%d] getAppsAppCallsCallLogOK %+v", 200, o.Payload)
}
func (o *GetAppsAppCallsCallLogOK) 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
}
// NewGetAppsAppCallsCallLogNotFound creates a GetAppsAppCallsCallLogNotFound with default headers values
func NewGetAppsAppCallsCallLogNotFound() *GetAppsAppCallsCallLogNotFound {
return &GetAppsAppCallsCallLogNotFound{}
}
/*GetAppsAppCallsCallLogNotFound handles this case with default header values.
Log not found.
*/
type GetAppsAppCallsCallLogNotFound struct {
Payload *models.Error
}
func (o *GetAppsAppCallsCallLogNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls/{call}/log][%d] getAppsAppCallsCallLogNotFound %+v", 404, o.Payload)
}
func (o *GetAppsAppCallsCallLogNotFound) 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,90 @@
// Code generated by go-swagger; DO NOT EDIT.
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
}
/*
DeleteAppsAppCallsCallLog deletes call log entry
Delete call log entry
*/
func (a *Client) DeleteAppsAppCallsCallLog(params *DeleteAppsAppCallsCallLogParams) (*DeleteAppsAppCallsCallLogAccepted, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAppsAppCallsCallLogParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteAppsAppCallsCallLog",
Method: "DELETE",
PathPattern: "/apps/{app}/calls/{call}/log",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteAppsAppCallsCallLogReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteAppsAppCallsCallLogAccepted), nil
}
/*
GetAppsAppCallsCallLog gets call logs
Get call logs
*/
func (a *Client) GetAppsAppCallsCallLog(params *GetAppsAppCallsCallLogParams) (*GetAppsAppCallsCallLogOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsAppCallsCallLogParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsAppCallsCallLog",
Method: "GET",
PathPattern: "/apps/{app}/calls/{call}/log",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsAppCallsCallLogReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsAppCallsCallLogOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,158 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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"
)
// NewDeleteAppsAppRoutesRouteParams creates a new DeleteAppsAppRoutesRouteParams object
// with the default values initialized.
func NewDeleteAppsAppRoutesRouteParams() *DeleteAppsAppRoutesRouteParams {
var ()
return &DeleteAppsAppRoutesRouteParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAppsAppRoutesRouteParamsWithTimeout creates a new DeleteAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDeleteAppsAppRoutesRouteParamsWithTimeout(timeout time.Duration) *DeleteAppsAppRoutesRouteParams {
var ()
return &DeleteAppsAppRoutesRouteParams{
timeout: timeout,
}
}
// NewDeleteAppsAppRoutesRouteParamsWithContext creates a new DeleteAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a context for a request
func NewDeleteAppsAppRoutesRouteParamsWithContext(ctx context.Context) *DeleteAppsAppRoutesRouteParams {
var ()
return &DeleteAppsAppRoutesRouteParams{
Context: ctx,
}
}
// NewDeleteAppsAppRoutesRouteParamsWithHTTPClient creates a new DeleteAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDeleteAppsAppRoutesRouteParamsWithHTTPClient(client *http.Client) *DeleteAppsAppRoutesRouteParams {
var ()
return &DeleteAppsAppRoutesRouteParams{
HTTPClient: client,
}
}
/*DeleteAppsAppRoutesRouteParams contains all the parameters to send to the API endpoint
for the delete apps app routes route operation typically these are written to a http.Request
*/
type DeleteAppsAppRoutesRouteParams struct {
/*App
Name of app for this set of routes.
*/
App string
/*Route
Route name
*/
Route string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) WithTimeout(timeout time.Duration) *DeleteAppsAppRoutesRouteParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) WithContext(ctx context.Context) *DeleteAppsAppRoutesRouteParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) WithHTTPClient(client *http.Client) *DeleteAppsAppRoutesRouteParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) WithApp(app string) *DeleteAppsAppRoutesRouteParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) SetApp(app string) {
o.App = app
}
// WithRoute adds the route to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) WithRoute(route string) *DeleteAppsAppRoutesRouteParams {
o.SetRoute(route)
return o
}
// SetRoute adds the route to the delete apps app routes route params
func (o *DeleteAppsAppRoutesRouteParams) SetRoute(route string) {
o.Route = route
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAppsAppRoutesRouteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
// path param route
if err := r.SetPathParam("route", o.Route); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,140 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// DeleteAppsAppRoutesRouteReader is a Reader for the DeleteAppsAppRoutesRoute structure.
type DeleteAppsAppRoutesRouteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAppsAppRoutesRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteAppsAppRoutesRouteOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewDeleteAppsAppRoutesRouteNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewDeleteAppsAppRoutesRouteDefault(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
}
}
// NewDeleteAppsAppRoutesRouteOK creates a DeleteAppsAppRoutesRouteOK with default headers values
func NewDeleteAppsAppRoutesRouteOK() *DeleteAppsAppRoutesRouteOK {
return &DeleteAppsAppRoutesRouteOK{}
}
/*DeleteAppsAppRoutesRouteOK handles this case with default header values.
Route successfully deleted.
*/
type DeleteAppsAppRoutesRouteOK struct {
}
func (o *DeleteAppsAppRoutesRouteOK) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}/routes/{route}][%d] deleteAppsAppRoutesRouteOK ", 200)
}
func (o *DeleteAppsAppRoutesRouteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAppsAppRoutesRouteNotFound creates a DeleteAppsAppRoutesRouteNotFound with default headers values
func NewDeleteAppsAppRoutesRouteNotFound() *DeleteAppsAppRoutesRouteNotFound {
return &DeleteAppsAppRoutesRouteNotFound{}
}
/*DeleteAppsAppRoutesRouteNotFound handles this case with default header values.
Route does not exist.
*/
type DeleteAppsAppRoutesRouteNotFound struct {
Payload *models.Error
}
func (o *DeleteAppsAppRoutesRouteNotFound) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}/routes/{route}][%d] deleteAppsAppRoutesRouteNotFound %+v", 404, o.Payload)
}
func (o *DeleteAppsAppRoutesRouteNotFound) 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
}
// NewDeleteAppsAppRoutesRouteDefault creates a DeleteAppsAppRoutesRouteDefault with default headers values
func NewDeleteAppsAppRoutesRouteDefault(code int) *DeleteAppsAppRoutesRouteDefault {
return &DeleteAppsAppRoutesRouteDefault{
_statusCode: code,
}
}
/*DeleteAppsAppRoutesRouteDefault handles this case with default header values.
Unexpected error
*/
type DeleteAppsAppRoutesRouteDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the delete apps app routes route default response
func (o *DeleteAppsAppRoutesRouteDefault) Code() int {
return o._statusCode
}
func (o *DeleteAppsAppRoutesRouteDefault) Error() string {
return fmt.Sprintf("[DELETE /apps/{app}/routes/{route}][%d] DeleteAppsAppRoutesRoute default %+v", o._statusCode, o.Payload)
}
func (o *DeleteAppsAppRoutesRouteDefault) 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,137 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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"
)
// NewGetAppsAppRoutesParams creates a new GetAppsAppRoutesParams object
// with the default values initialized.
func NewGetAppsAppRoutesParams() *GetAppsAppRoutesParams {
var ()
return &GetAppsAppRoutesParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAppsAppRoutesParamsWithTimeout creates a new GetAppsAppRoutesParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetAppsAppRoutesParamsWithTimeout(timeout time.Duration) *GetAppsAppRoutesParams {
var ()
return &GetAppsAppRoutesParams{
timeout: timeout,
}
}
// NewGetAppsAppRoutesParamsWithContext creates a new GetAppsAppRoutesParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetAppsAppRoutesParamsWithContext(ctx context.Context) *GetAppsAppRoutesParams {
var ()
return &GetAppsAppRoutesParams{
Context: ctx,
}
}
// NewGetAppsAppRoutesParamsWithHTTPClient creates a new GetAppsAppRoutesParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetAppsAppRoutesParamsWithHTTPClient(client *http.Client) *GetAppsAppRoutesParams {
var ()
return &GetAppsAppRoutesParams{
HTTPClient: client,
}
}
/*GetAppsAppRoutesParams contains all the parameters to send to the API endpoint
for the get apps app routes operation typically these are written to a http.Request
*/
type GetAppsAppRoutesParams struct {
/*App
Name of app for this set of routes.
*/
App string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps app routes params
func (o *GetAppsAppRoutesParams) WithTimeout(timeout time.Duration) *GetAppsAppRoutesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps app routes params
func (o *GetAppsAppRoutesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps app routes params
func (o *GetAppsAppRoutesParams) WithContext(ctx context.Context) *GetAppsAppRoutesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps app routes params
func (o *GetAppsAppRoutesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps app routes params
func (o *GetAppsAppRoutesParams) WithHTTPClient(client *http.Client) *GetAppsAppRoutesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps app routes params
func (o *GetAppsAppRoutesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the get apps app routes params
func (o *GetAppsAppRoutesParams) WithApp(app string) *GetAppsAppRoutesParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the get apps app routes params
func (o *GetAppsAppRoutesParams) SetApp(app string) {
o.App = app
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsAppRoutesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,148 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// GetAppsAppRoutesReader is a Reader for the GetAppsAppRoutes structure.
type GetAppsAppRoutesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsAppRoutesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsAppRoutesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetAppsAppRoutesNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetAppsAppRoutesDefault(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
}
}
// NewGetAppsAppRoutesOK creates a GetAppsAppRoutesOK with default headers values
func NewGetAppsAppRoutesOK() *GetAppsAppRoutesOK {
return &GetAppsAppRoutesOK{}
}
/*GetAppsAppRoutesOK handles this case with default header values.
Route information
*/
type GetAppsAppRoutesOK struct {
Payload *models.RoutesWrapper
}
func (o *GetAppsAppRoutesOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}/routes][%d] getAppsAppRoutesOK %+v", 200, o.Payload)
}
func (o *GetAppsAppRoutesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RoutesWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAppsAppRoutesNotFound creates a GetAppsAppRoutesNotFound with default headers values
func NewGetAppsAppRoutesNotFound() *GetAppsAppRoutesNotFound {
return &GetAppsAppRoutesNotFound{}
}
/*GetAppsAppRoutesNotFound handles this case with default header values.
App does not exist.
*/
type GetAppsAppRoutesNotFound struct {
Payload *models.Error
}
func (o *GetAppsAppRoutesNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}/routes][%d] getAppsAppRoutesNotFound %+v", 404, o.Payload)
}
func (o *GetAppsAppRoutesNotFound) 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
}
// NewGetAppsAppRoutesDefault creates a GetAppsAppRoutesDefault with default headers values
func NewGetAppsAppRoutesDefault(code int) *GetAppsAppRoutesDefault {
return &GetAppsAppRoutesDefault{
_statusCode: code,
}
}
/*GetAppsAppRoutesDefault handles this case with default header values.
Unexpected error
*/
type GetAppsAppRoutesDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get apps app routes default response
func (o *GetAppsAppRoutesDefault) Code() int {
return o._statusCode
}
func (o *GetAppsAppRoutesDefault) Error() string {
return fmt.Sprintf("[GET /apps/{app}/routes][%d] GetAppsAppRoutes default %+v", o._statusCode, o.Payload)
}
func (o *GetAppsAppRoutesDefault) 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,158 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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"
)
// NewGetAppsAppRoutesRouteParams creates a new GetAppsAppRoutesRouteParams object
// with the default values initialized.
func NewGetAppsAppRoutesRouteParams() *GetAppsAppRoutesRouteParams {
var ()
return &GetAppsAppRoutesRouteParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAppsAppRoutesRouteParamsWithTimeout creates a new GetAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetAppsAppRoutesRouteParamsWithTimeout(timeout time.Duration) *GetAppsAppRoutesRouteParams {
var ()
return &GetAppsAppRoutesRouteParams{
timeout: timeout,
}
}
// NewGetAppsAppRoutesRouteParamsWithContext creates a new GetAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetAppsAppRoutesRouteParamsWithContext(ctx context.Context) *GetAppsAppRoutesRouteParams {
var ()
return &GetAppsAppRoutesRouteParams{
Context: ctx,
}
}
// NewGetAppsAppRoutesRouteParamsWithHTTPClient creates a new GetAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetAppsAppRoutesRouteParamsWithHTTPClient(client *http.Client) *GetAppsAppRoutesRouteParams {
var ()
return &GetAppsAppRoutesRouteParams{
HTTPClient: client,
}
}
/*GetAppsAppRoutesRouteParams contains all the parameters to send to the API endpoint
for the get apps app routes route operation typically these are written to a http.Request
*/
type GetAppsAppRoutesRouteParams struct {
/*App
Name of app for this set of routes.
*/
App string
/*Route
Route name
*/
Route string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) WithTimeout(timeout time.Duration) *GetAppsAppRoutesRouteParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) WithContext(ctx context.Context) *GetAppsAppRoutesRouteParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) WithHTTPClient(client *http.Client) *GetAppsAppRoutesRouteParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) WithApp(app string) *GetAppsAppRoutesRouteParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) SetApp(app string) {
o.App = app
}
// WithRoute adds the route to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) WithRoute(route string) *GetAppsAppRoutesRouteParams {
o.SetRoute(route)
return o
}
// SetRoute adds the route to the get apps app routes route params
func (o *GetAppsAppRoutesRouteParams) SetRoute(route string) {
o.Route = route
}
// WriteToRequest writes these params to a swagger request
func (o *GetAppsAppRoutesRouteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
// path param route
if err := r.SetPathParam("route", o.Route); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,148 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// GetAppsAppRoutesRouteReader is a Reader for the GetAppsAppRoutesRoute structure.
type GetAppsAppRoutesRouteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAppsAppRoutesRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAppsAppRoutesRouteOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetAppsAppRoutesRouteNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewGetAppsAppRoutesRouteDefault(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
}
}
// NewGetAppsAppRoutesRouteOK creates a GetAppsAppRoutesRouteOK with default headers values
func NewGetAppsAppRoutesRouteOK() *GetAppsAppRoutesRouteOK {
return &GetAppsAppRoutesRouteOK{}
}
/*GetAppsAppRoutesRouteOK handles this case with default header values.
Route information
*/
type GetAppsAppRoutesRouteOK struct {
Payload *models.RouteWrapper
}
func (o *GetAppsAppRoutesRouteOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}/routes/{route}][%d] getAppsAppRoutesRouteOK %+v", 200, o.Payload)
}
func (o *GetAppsAppRoutesRouteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RouteWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAppsAppRoutesRouteNotFound creates a GetAppsAppRoutesRouteNotFound with default headers values
func NewGetAppsAppRoutesRouteNotFound() *GetAppsAppRoutesRouteNotFound {
return &GetAppsAppRoutesRouteNotFound{}
}
/*GetAppsAppRoutesRouteNotFound handles this case with default header values.
Route does not exist.
*/
type GetAppsAppRoutesRouteNotFound struct {
Payload *models.Error
}
func (o *GetAppsAppRoutesRouteNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}/routes/{route}][%d] getAppsAppRoutesRouteNotFound %+v", 404, o.Payload)
}
func (o *GetAppsAppRoutesRouteNotFound) 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
}
// NewGetAppsAppRoutesRouteDefault creates a GetAppsAppRoutesRouteDefault with default headers values
func NewGetAppsAppRoutesRouteDefault(code int) *GetAppsAppRoutesRouteDefault {
return &GetAppsAppRoutesRouteDefault{
_statusCode: code,
}
}
/*GetAppsAppRoutesRouteDefault handles this case with default header values.
Unexpected error
*/
type GetAppsAppRoutesRouteDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get apps app routes route default response
func (o *GetAppsAppRoutesRouteDefault) Code() int {
return o._statusCode
}
func (o *GetAppsAppRoutesRouteDefault) Error() string {
return fmt.Sprintf("[GET /apps/{app}/routes/{route}][%d] GetAppsAppRoutesRoute default %+v", o._statusCode, o.Payload)
}
func (o *GetAppsAppRoutesRouteDefault) 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,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// NewPatchAppsAppRoutesRouteParams creates a new PatchAppsAppRoutesRouteParams object
// with the default values initialized.
func NewPatchAppsAppRoutesRouteParams() *PatchAppsAppRoutesRouteParams {
var ()
return &PatchAppsAppRoutesRouteParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAppsAppRoutesRouteParamsWithTimeout creates a new PatchAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPatchAppsAppRoutesRouteParamsWithTimeout(timeout time.Duration) *PatchAppsAppRoutesRouteParams {
var ()
return &PatchAppsAppRoutesRouteParams{
timeout: timeout,
}
}
// NewPatchAppsAppRoutesRouteParamsWithContext creates a new PatchAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a context for a request
func NewPatchAppsAppRoutesRouteParamsWithContext(ctx context.Context) *PatchAppsAppRoutesRouteParams {
var ()
return &PatchAppsAppRoutesRouteParams{
Context: ctx,
}
}
// NewPatchAppsAppRoutesRouteParamsWithHTTPClient creates a new PatchAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPatchAppsAppRoutesRouteParamsWithHTTPClient(client *http.Client) *PatchAppsAppRoutesRouteParams {
var ()
return &PatchAppsAppRoutesRouteParams{
HTTPClient: client,
}
}
/*PatchAppsAppRoutesRouteParams contains all the parameters to send to the API endpoint
for the patch apps app routes route operation typically these are written to a http.Request
*/
type PatchAppsAppRoutesRouteParams struct {
/*App
name of the app.
*/
App string
/*Body
One route to post.
*/
Body *models.RouteWrapper
/*Route
route path.
*/
Route string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) WithTimeout(timeout time.Duration) *PatchAppsAppRoutesRouteParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) WithContext(ctx context.Context) *PatchAppsAppRoutesRouteParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) WithHTTPClient(client *http.Client) *PatchAppsAppRoutesRouteParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) WithApp(app string) *PatchAppsAppRoutesRouteParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) SetApp(app string) {
o.App = app
}
// WithBody adds the body to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) WithBody(body *models.RouteWrapper) *PatchAppsAppRoutesRouteParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) SetBody(body *models.RouteWrapper) {
o.Body = body
}
// WithRoute adds the route to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) WithRoute(route string) *PatchAppsAppRoutesRouteParams {
o.SetRoute(route)
return o
}
// SetRoute adds the route to the patch apps app routes route params
func (o *PatchAppsAppRoutesRouteParams) SetRoute(route string) {
o.Route = route
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAppsAppRoutesRouteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if o.Body == nil {
o.Body = new(models.RouteWrapper)
}
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param route
if err := r.SetPathParam("route", o.Route); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// PatchAppsAppRoutesRouteReader is a Reader for the PatchAppsAppRoutesRoute structure.
type PatchAppsAppRoutesRouteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAppsAppRoutesRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAppsAppRoutesRouteOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPatchAppsAppRoutesRouteBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPatchAppsAppRoutesRouteNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewPatchAppsAppRoutesRouteDefault(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
}
}
// NewPatchAppsAppRoutesRouteOK creates a PatchAppsAppRoutesRouteOK with default headers values
func NewPatchAppsAppRoutesRouteOK() *PatchAppsAppRoutesRouteOK {
return &PatchAppsAppRoutesRouteOK{}
}
/*PatchAppsAppRoutesRouteOK handles this case with default header values.
Route updated
*/
type PatchAppsAppRoutesRouteOK struct {
Payload *models.RouteWrapper
}
func (o *PatchAppsAppRoutesRouteOK) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}/routes/{route}][%d] patchAppsAppRoutesRouteOK %+v", 200, o.Payload)
}
func (o *PatchAppsAppRoutesRouteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RouteWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPatchAppsAppRoutesRouteBadRequest creates a PatchAppsAppRoutesRouteBadRequest with default headers values
func NewPatchAppsAppRoutesRouteBadRequest() *PatchAppsAppRoutesRouteBadRequest {
return &PatchAppsAppRoutesRouteBadRequest{}
}
/*PatchAppsAppRoutesRouteBadRequest handles this case with default header values.
Invalid route due to parameters being missing or invalid.
*/
type PatchAppsAppRoutesRouteBadRequest struct {
Payload *models.Error
}
func (o *PatchAppsAppRoutesRouteBadRequest) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}/routes/{route}][%d] patchAppsAppRoutesRouteBadRequest %+v", 400, o.Payload)
}
func (o *PatchAppsAppRoutesRouteBadRequest) 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
}
// NewPatchAppsAppRoutesRouteNotFound creates a PatchAppsAppRoutesRouteNotFound with default headers values
func NewPatchAppsAppRoutesRouteNotFound() *PatchAppsAppRoutesRouteNotFound {
return &PatchAppsAppRoutesRouteNotFound{}
}
/*PatchAppsAppRoutesRouteNotFound handles this case with default header values.
App / Route does not exist.
*/
type PatchAppsAppRoutesRouteNotFound struct {
Payload *models.Error
}
func (o *PatchAppsAppRoutesRouteNotFound) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}/routes/{route}][%d] patchAppsAppRoutesRouteNotFound %+v", 404, o.Payload)
}
func (o *PatchAppsAppRoutesRouteNotFound) 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
}
// NewPatchAppsAppRoutesRouteDefault creates a PatchAppsAppRoutesRouteDefault with default headers values
func NewPatchAppsAppRoutesRouteDefault(code int) *PatchAppsAppRoutesRouteDefault {
return &PatchAppsAppRoutesRouteDefault{
_statusCode: code,
}
}
/*PatchAppsAppRoutesRouteDefault handles this case with default header values.
Unexpected error
*/
type PatchAppsAppRoutesRouteDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the patch apps app routes route default response
func (o *PatchAppsAppRoutesRouteDefault) Code() int {
return o._statusCode
}
func (o *PatchAppsAppRoutesRouteDefault) Error() string {
return fmt.Sprintf("[PATCH /apps/{app}/routes/{route}][%d] PatchAppsAppRoutesRoute default %+v", o._statusCode, o.Payload)
}
func (o *PatchAppsAppRoutesRouteDefault) 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,163 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// NewPostAppsAppRoutesParams creates a new PostAppsAppRoutesParams object
// with the default values initialized.
func NewPostAppsAppRoutesParams() *PostAppsAppRoutesParams {
var ()
return &PostAppsAppRoutesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAppsAppRoutesParamsWithTimeout creates a new PostAppsAppRoutesParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPostAppsAppRoutesParamsWithTimeout(timeout time.Duration) *PostAppsAppRoutesParams {
var ()
return &PostAppsAppRoutesParams{
timeout: timeout,
}
}
// NewPostAppsAppRoutesParamsWithContext creates a new PostAppsAppRoutesParams object
// with the default values initialized, and the ability to set a context for a request
func NewPostAppsAppRoutesParamsWithContext(ctx context.Context) *PostAppsAppRoutesParams {
var ()
return &PostAppsAppRoutesParams{
Context: ctx,
}
}
// NewPostAppsAppRoutesParamsWithHTTPClient creates a new PostAppsAppRoutesParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPostAppsAppRoutesParamsWithHTTPClient(client *http.Client) *PostAppsAppRoutesParams {
var ()
return &PostAppsAppRoutesParams{
HTTPClient: client,
}
}
/*PostAppsAppRoutesParams contains all the parameters to send to the API endpoint
for the post apps app routes operation typically these are written to a http.Request
*/
type PostAppsAppRoutesParams struct {
/*App
name of the app.
*/
App string
/*Body
One route to post.
*/
Body *models.RouteWrapper
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the post apps app routes params
func (o *PostAppsAppRoutesParams) WithTimeout(timeout time.Duration) *PostAppsAppRoutesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post apps app routes params
func (o *PostAppsAppRoutesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post apps app routes params
func (o *PostAppsAppRoutesParams) WithContext(ctx context.Context) *PostAppsAppRoutesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post apps app routes params
func (o *PostAppsAppRoutesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post apps app routes params
func (o *PostAppsAppRoutesParams) WithHTTPClient(client *http.Client) *PostAppsAppRoutesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post apps app routes params
func (o *PostAppsAppRoutesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the post apps app routes params
func (o *PostAppsAppRoutesParams) WithApp(app string) *PostAppsAppRoutesParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the post apps app routes params
func (o *PostAppsAppRoutesParams) SetApp(app string) {
o.App = app
}
// WithBody adds the body to the post apps app routes params
func (o *PostAppsAppRoutesParams) WithBody(body *models.RouteWrapper) *PostAppsAppRoutesParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post apps app routes params
func (o *PostAppsAppRoutesParams) SetBody(body *models.RouteWrapper) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PostAppsAppRoutesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if o.Body == nil {
o.Body = new(models.RouteWrapper)
}
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,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// PostAppsAppRoutesReader is a Reader for the PostAppsAppRoutes structure.
type PostAppsAppRoutesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAppsAppRoutesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAppsAppRoutesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPostAppsAppRoutesBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewPostAppsAppRoutesConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewPostAppsAppRoutesDefault(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
}
}
// NewPostAppsAppRoutesOK creates a PostAppsAppRoutesOK with default headers values
func NewPostAppsAppRoutesOK() *PostAppsAppRoutesOK {
return &PostAppsAppRoutesOK{}
}
/*PostAppsAppRoutesOK handles this case with default header values.
Route created
*/
type PostAppsAppRoutesOK struct {
Payload *models.RouteWrapper
}
func (o *PostAppsAppRoutesOK) Error() string {
return fmt.Sprintf("[POST /apps/{app}/routes][%d] postAppsAppRoutesOK %+v", 200, o.Payload)
}
func (o *PostAppsAppRoutesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RouteWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostAppsAppRoutesBadRequest creates a PostAppsAppRoutesBadRequest with default headers values
func NewPostAppsAppRoutesBadRequest() *PostAppsAppRoutesBadRequest {
return &PostAppsAppRoutesBadRequest{}
}
/*PostAppsAppRoutesBadRequest handles this case with default header values.
Invalid route due to parameters being missing or invalid.
*/
type PostAppsAppRoutesBadRequest struct {
Payload *models.Error
}
func (o *PostAppsAppRoutesBadRequest) Error() string {
return fmt.Sprintf("[POST /apps/{app}/routes][%d] postAppsAppRoutesBadRequest %+v", 400, o.Payload)
}
func (o *PostAppsAppRoutesBadRequest) 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
}
// NewPostAppsAppRoutesConflict creates a PostAppsAppRoutesConflict with default headers values
func NewPostAppsAppRoutesConflict() *PostAppsAppRoutesConflict {
return &PostAppsAppRoutesConflict{}
}
/*PostAppsAppRoutesConflict handles this case with default header values.
Route already exists.
*/
type PostAppsAppRoutesConflict struct {
Payload *models.Error
}
func (o *PostAppsAppRoutesConflict) Error() string {
return fmt.Sprintf("[POST /apps/{app}/routes][%d] postAppsAppRoutesConflict %+v", 409, o.Payload)
}
func (o *PostAppsAppRoutesConflict) 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
}
// NewPostAppsAppRoutesDefault creates a PostAppsAppRoutesDefault with default headers values
func NewPostAppsAppRoutesDefault(code int) *PostAppsAppRoutesDefault {
return &PostAppsAppRoutesDefault{
_statusCode: code,
}
}
/*PostAppsAppRoutesDefault handles this case with default header values.
Unexpected error
*/
type PostAppsAppRoutesDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the post apps app routes default response
func (o *PostAppsAppRoutesDefault) Code() int {
return o._statusCode
}
func (o *PostAppsAppRoutesDefault) Error() string {
return fmt.Sprintf("[POST /apps/{app}/routes][%d] PostAppsAppRoutes default %+v", o._statusCode, o.Payload)
}
func (o *PostAppsAppRoutesDefault) 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,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// NewPutAppsAppRoutesRouteParams creates a new PutAppsAppRoutesRouteParams object
// with the default values initialized.
func NewPutAppsAppRoutesRouteParams() *PutAppsAppRoutesRouteParams {
var ()
return &PutAppsAppRoutesRouteParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutAppsAppRoutesRouteParamsWithTimeout creates a new PutAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPutAppsAppRoutesRouteParamsWithTimeout(timeout time.Duration) *PutAppsAppRoutesRouteParams {
var ()
return &PutAppsAppRoutesRouteParams{
timeout: timeout,
}
}
// NewPutAppsAppRoutesRouteParamsWithContext creates a new PutAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a context for a request
func NewPutAppsAppRoutesRouteParamsWithContext(ctx context.Context) *PutAppsAppRoutesRouteParams {
var ()
return &PutAppsAppRoutesRouteParams{
Context: ctx,
}
}
// NewPutAppsAppRoutesRouteParamsWithHTTPClient creates a new PutAppsAppRoutesRouteParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPutAppsAppRoutesRouteParamsWithHTTPClient(client *http.Client) *PutAppsAppRoutesRouteParams {
var ()
return &PutAppsAppRoutesRouteParams{
HTTPClient: client,
}
}
/*PutAppsAppRoutesRouteParams contains all the parameters to send to the API endpoint
for the put apps app routes route operation typically these are written to a http.Request
*/
type PutAppsAppRoutesRouteParams struct {
/*App
name of the app.
*/
App string
/*Body
One route to post.
*/
Body *models.RouteWrapper
/*Route
route path.
*/
Route string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) WithTimeout(timeout time.Duration) *PutAppsAppRoutesRouteParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) WithContext(ctx context.Context) *PutAppsAppRoutesRouteParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) WithHTTPClient(client *http.Client) *PutAppsAppRoutesRouteParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithApp adds the app to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) WithApp(app string) *PutAppsAppRoutesRouteParams {
o.SetApp(app)
return o
}
// SetApp adds the app to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) SetApp(app string) {
o.App = app
}
// WithBody adds the body to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) WithBody(body *models.RouteWrapper) *PutAppsAppRoutesRouteParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) SetBody(body *models.RouteWrapper) {
o.Body = body
}
// WithRoute adds the route to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) WithRoute(route string) *PutAppsAppRoutesRouteParams {
o.SetRoute(route)
return o
}
// SetRoute adds the route to the put apps app routes route params
func (o *PutAppsAppRoutesRouteParams) SetRoute(route string) {
o.Route = route
}
// WriteToRequest writes these params to a swagger request
func (o *PutAppsAppRoutesRouteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param app
if err := r.SetPathParam("app", o.App); err != nil {
return err
}
if o.Body == nil {
o.Body = new(models.RouteWrapper)
}
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param route
if err := r.SetPathParam("route", o.Route); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,148 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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/fnproject/fn_go/models"
)
// PutAppsAppRoutesRouteReader is a Reader for the PutAppsAppRoutesRoute structure.
type PutAppsAppRoutesRouteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PutAppsAppRoutesRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutAppsAppRoutesRouteOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPutAppsAppRoutesRouteBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
result := NewPutAppsAppRoutesRouteDefault(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
}
}
// NewPutAppsAppRoutesRouteOK creates a PutAppsAppRoutesRouteOK with default headers values
func NewPutAppsAppRoutesRouteOK() *PutAppsAppRoutesRouteOK {
return &PutAppsAppRoutesRouteOK{}
}
/*PutAppsAppRoutesRouteOK handles this case with default header values.
Route created or updated
*/
type PutAppsAppRoutesRouteOK struct {
Payload *models.RouteWrapper
}
func (o *PutAppsAppRoutesRouteOK) Error() string {
return fmt.Sprintf("[PUT /apps/{app}/routes/{route}][%d] putAppsAppRoutesRouteOK %+v", 200, o.Payload)
}
func (o *PutAppsAppRoutesRouteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.RouteWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPutAppsAppRoutesRouteBadRequest creates a PutAppsAppRoutesRouteBadRequest with default headers values
func NewPutAppsAppRoutesRouteBadRequest() *PutAppsAppRoutesRouteBadRequest {
return &PutAppsAppRoutesRouteBadRequest{}
}
/*PutAppsAppRoutesRouteBadRequest handles this case with default header values.
Invalid route due to parameters being missing or invalid.
*/
type PutAppsAppRoutesRouteBadRequest struct {
Payload *models.Error
}
func (o *PutAppsAppRoutesRouteBadRequest) Error() string {
return fmt.Sprintf("[PUT /apps/{app}/routes/{route}][%d] putAppsAppRoutesRouteBadRequest %+v", 400, o.Payload)
}
func (o *PutAppsAppRoutesRouteBadRequest) 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
}
// NewPutAppsAppRoutesRouteDefault creates a PutAppsAppRoutesRouteDefault with default headers values
func NewPutAppsAppRoutesRouteDefault(code int) *PutAppsAppRoutesRouteDefault {
return &PutAppsAppRoutesRouteDefault{
_statusCode: code,
}
}
/*PutAppsAppRoutesRouteDefault handles this case with default header values.
Unexpected error
*/
type PutAppsAppRoutesRouteDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the put apps app routes route default response
func (o *PutAppsAppRoutesRouteDefault) Code() int {
return o._statusCode
}
func (o *PutAppsAppRoutesRouteDefault) Error() string {
return fmt.Sprintf("[PUT /apps/{app}/routes/{route}][%d] PutAppsAppRoutesRoute default %+v", o._statusCode, o.Payload)
}
func (o *PutAppsAppRoutesRouteDefault) 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,210 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes
// 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 routes API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for routes API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
DeleteAppsAppRoutesRoute deletes the route
Deletes the route.
*/
func (a *Client) DeleteAppsAppRoutesRoute(params *DeleteAppsAppRoutesRouteParams) (*DeleteAppsAppRoutesRouteOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAppsAppRoutesRouteParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteAppsAppRoutesRoute",
Method: "DELETE",
PathPattern: "/apps/{app}/routes/{route}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteAppsAppRoutesRouteReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteAppsAppRoutesRouteOK), nil
}
/*
GetAppsAppRoutes gets route list by app name
This will list routes for a particular app.
*/
func (a *Client) GetAppsAppRoutes(params *GetAppsAppRoutesParams) (*GetAppsAppRoutesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsAppRoutesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsAppRoutes",
Method: "GET",
PathPattern: "/apps/{app}/routes",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsAppRoutesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsAppRoutesOK), nil
}
/*
GetAppsAppRoutesRoute gets route by name
Gets a route by name.
*/
func (a *Client) GetAppsAppRoutesRoute(params *GetAppsAppRoutesRouteParams) (*GetAppsAppRoutesRouteOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAppsAppRoutesRouteParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsAppRoutesRoute",
Method: "GET",
PathPattern: "/apps/{app}/routes/{route}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAppsAppRoutesRouteReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetAppsAppRoutesRouteOK), nil
}
/*
PatchAppsAppRoutesRoute updates a route fails if the route or app does not exist accepts partial updates skips validation of zero values
Update a route
*/
func (a *Client) PatchAppsAppRoutesRoute(params *PatchAppsAppRoutesRouteParams) (*PatchAppsAppRoutesRouteOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAppsAppRoutesRouteParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PatchAppsAppRoutesRoute",
Method: "PATCH",
PathPattern: "/apps/{app}/routes/{route}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PatchAppsAppRoutesRouteReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PatchAppsAppRoutesRouteOK), nil
}
/*
PostAppsAppRoutes creates new route
Create a new route in an app, if app doesn't exists, it creates the app. Post does not skip validation of zero values.
*/
func (a *Client) PostAppsAppRoutes(params *PostAppsAppRoutesParams) (*PostAppsAppRoutesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAppsAppRoutesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PostAppsAppRoutes",
Method: "POST",
PathPattern: "/apps/{app}/routes",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PostAppsAppRoutesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PostAppsAppRoutesOK), nil
}
/*
PutAppsAppRoutesRoute creates a route if it does not exist update if it does will also create app if it does not exist put does not skip validation of zero values
Update or Create a route
*/
func (a *Client) PutAppsAppRoutesRoute(params *PutAppsAppRoutesRouteParams) (*PutAppsAppRoutesRouteOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPutAppsAppRoutesRouteParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PutAppsAppRoutesRoute",
Method: "PUT",
PathPattern: "/apps/{app}/routes/{route}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PutAppsAppRoutesRouteReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PutAppsAppRoutesRouteOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,114 @@
// Code generated by go-swagger; DO NOT EDIT.
package tasks
// 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"
)
// NewGetTasksParams creates a new GetTasksParams object
// with the default values initialized.
func NewGetTasksParams() *GetTasksParams {
return &GetTasksParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetTasksParamsWithTimeout creates a new GetTasksParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetTasksParamsWithTimeout(timeout time.Duration) *GetTasksParams {
return &GetTasksParams{
timeout: timeout,
}
}
// NewGetTasksParamsWithContext creates a new GetTasksParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetTasksParamsWithContext(ctx context.Context) *GetTasksParams {
return &GetTasksParams{
Context: ctx,
}
}
// NewGetTasksParamsWithHTTPClient creates a new GetTasksParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetTasksParamsWithHTTPClient(client *http.Client) *GetTasksParams {
return &GetTasksParams{
HTTPClient: client,
}
}
/*GetTasksParams contains all the parameters to send to the API endpoint
for the get tasks operation typically these are written to a http.Request
*/
type GetTasksParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get tasks params
func (o *GetTasksParams) WithTimeout(timeout time.Duration) *GetTasksParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get tasks params
func (o *GetTasksParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get tasks params
func (o *GetTasksParams) WithContext(ctx context.Context) *GetTasksParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get tasks params
func (o *GetTasksParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get tasks params
func (o *GetTasksParams) WithHTTPClient(client *http.Client) *GetTasksParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get tasks params
func (o *GetTasksParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetTasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,112 @@
// Code generated by go-swagger; DO NOT EDIT.
package tasks
// 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/fnproject/fn_go/models"
)
// GetTasksReader is a Reader for the GetTasks structure.
type GetTasksReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetTasksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetTasksOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewGetTasksDefault(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
}
}
// NewGetTasksOK creates a GetTasksOK with default headers values
func NewGetTasksOK() *GetTasksOK {
return &GetTasksOK{}
}
/*GetTasksOK handles this case with default header values.
Task information
*/
type GetTasksOK struct {
Payload *models.TaskWrapper
}
func (o *GetTasksOK) Error() string {
return fmt.Sprintf("[GET /tasks][%d] getTasksOK %+v", 200, o.Payload)
}
func (o *GetTasksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.TaskWrapper)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetTasksDefault creates a GetTasksDefault with default headers values
func NewGetTasksDefault(code int) *GetTasksDefault {
return &GetTasksDefault{
_statusCode: code,
}
}
/*GetTasksDefault handles this case with default header values.
Unexpected error
*/
type GetTasksDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the get tasks default response
func (o *GetTasksDefault) Code() int {
return o._statusCode
}
func (o *GetTasksDefault) Error() string {
return fmt.Sprintf("[GET /tasks][%d] GetTasks default %+v", o._statusCode, o.Payload)
}
func (o *GetTasksDefault) 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 @@
// Code generated by go-swagger; DO NOT EDIT.
package tasks
// 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 tasks API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for tasks API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
GetTasks gets next task
Gets the next task in the queue, ready for processing. Consumers should start processing tasks in order. No other consumer can retrieve this task.
*/
func (a *Client) GetTasks(params *GetTasksParams) (*GetTasksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetTasksParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetTasks",
Method: "GET",
PathPattern: "/tasks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetTasksReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetTasksOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@@ -0,0 +1,114 @@
// Code generated by go-swagger; DO NOT EDIT.
package version
// 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"
)
// NewGetVersionParams creates a new GetVersionParams object
// with the default values initialized.
func NewGetVersionParams() *GetVersionParams {
return &GetVersionParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetVersionParamsWithTimeout creates a new GetVersionParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetVersionParamsWithTimeout(timeout time.Duration) *GetVersionParams {
return &GetVersionParams{
timeout: timeout,
}
}
// NewGetVersionParamsWithContext creates a new GetVersionParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetVersionParamsWithContext(ctx context.Context) *GetVersionParams {
return &GetVersionParams{
Context: ctx,
}
}
// NewGetVersionParamsWithHTTPClient creates a new GetVersionParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetVersionParamsWithHTTPClient(client *http.Client) *GetVersionParams {
return &GetVersionParams{
HTTPClient: client,
}
}
/*GetVersionParams contains all the parameters to send to the API endpoint
for the get version operation typically these are written to a http.Request
*/
type GetVersionParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get version params
func (o *GetVersionParams) WithTimeout(timeout time.Duration) *GetVersionParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get version params
func (o *GetVersionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get version params
func (o *GetVersionParams) WithContext(ctx context.Context) *GetVersionParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get version params
func (o *GetVersionParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get version params
func (o *GetVersionParams) WithHTTPClient(client *http.Client) *GetVersionParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get version params
func (o *GetVersionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,67 @@
// Code generated by go-swagger; DO NOT EDIT.
package version
// 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/fnproject/fn_go/models"
)
// GetVersionReader is a Reader for the GetVersion structure.
type GetVersionReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetVersionOK()
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())
}
}
// NewGetVersionOK creates a GetVersionOK with default headers values
func NewGetVersionOK() *GetVersionOK {
return &GetVersionOK{}
}
/*GetVersionOK handles this case with default header values.
Daemon version.
*/
type GetVersionOK struct {
Payload *models.Version
}
func (o *GetVersionOK) Error() string {
return fmt.Sprintf("[GET /version][%d] getVersionOK %+v", 200, o.Payload)
}
func (o *GetVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Version)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -0,0 +1,58 @@
// Code generated by go-swagger; DO NOT EDIT.
package version
// 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 version API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for version API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
GetVersion gets daemon version
*/
func (a *Client) GetVersion(params *GetVersionParams) (*GetVersionOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetVersionParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetVersion",
Method: "GET",
PathPattern: "/version",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetVersionReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetVersionOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

58
vendor/github.com/fnproject/fn_go/models/app.go generated vendored Normal file
View File

@@ -0,0 +1,58 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// App app
// swagger:model App
type App struct {
// Application configuration
Config map[string]string `json:"config,omitempty"`
// Name of this app. Must be different than the image name. Can ony contain alphanumeric, -, and _.
// Read Only: true
Name string `json:"name,omitempty"`
}
/* polymorph App config false */
/* polymorph App name false */
// Validate validates this app
func (m *App) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *App) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *App) UnmarshalBinary(b []byte) error {
var res App
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

107
vendor/github.com/fnproject/fn_go/models/app_wrapper.go generated vendored Normal file
View File

@@ -0,0 +1,107 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// AppWrapper app wrapper
// swagger:model AppWrapper
type AppWrapper struct {
// app
// Required: true
App *App `json:"app"`
// error
Error *ErrorBody `json:"error,omitempty"`
}
/* polymorph AppWrapper app false */
/* polymorph AppWrapper error false */
// Validate validates this app wrapper
func (m *AppWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateApp(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateError(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AppWrapper) validateApp(formats strfmt.Registry) error {
if err := validate.Required("app", "body", m.App); err != nil {
return err
}
if m.App != nil {
if err := m.App.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("app")
}
return err
}
}
return nil
}
func (m *AppWrapper) validateError(formats strfmt.Registry) error {
if swag.IsZero(m.Error) { // not required
return nil
}
if m.Error != nil {
if err := m.Error.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("error")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AppWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AppWrapper) UnmarshalBinary(b []byte) error {
var res AppWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,117 @@
// 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"
"github.com/go-openapi/validate"
)
// AppsWrapper apps wrapper
// swagger:model AppsWrapper
type AppsWrapper struct {
// apps
// Required: true
Apps []*App `json:"apps"`
// error
Error *ErrorBody `json:"error,omitempty"`
}
/* polymorph AppsWrapper apps false */
/* polymorph AppsWrapper error false */
// Validate validates this apps wrapper
func (m *AppsWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateApps(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateError(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AppsWrapper) validateApps(formats strfmt.Registry) error {
if err := validate.Required("apps", "body", m.Apps); err != nil {
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
}
func (m *AppsWrapper) validateError(formats strfmt.Registry) error {
if swag.IsZero(m.Error) { // not required
return nil
}
if m.Error != nil {
if err := m.Error.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("error")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AppsWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AppsWrapper) UnmarshalBinary(b []byte) error {
var res AppsWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

89
vendor/github.com/fnproject/fn_go/models/call.go generated vendored Normal file
View File

@@ -0,0 +1,89 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// Call call
// swagger:model Call
type Call struct {
// App name that is assigned to a route that is being executed.
// Read Only: true
AppName string `json:"app_name,omitempty"`
// Time when call completed, whether it was successul or failed. Always in UTC.
// Read Only: true
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
// Time when call was submitted. Always in UTC.
// Read Only: true
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
// Call UUID ID.
// Read Only: true
ID string `json:"id,omitempty"`
// App route that is being executed.
// Read Only: true
Path string `json:"path,omitempty"`
// Time when call started execution. Always in UTC.
// Read Only: true
StartedAt strfmt.DateTime `json:"started_at,omitempty"`
// Call execution status.
// Read Only: true
Status string `json:"status,omitempty"`
}
/* polymorph Call app_name false */
/* polymorph Call completed_at false */
/* polymorph Call created_at false */
/* polymorph Call id false */
/* polymorph Call path false */
/* polymorph Call started_at false */
/* polymorph Call status false */
// Validate validates this call
func (m *Call) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *Call) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Call) UnmarshalBinary(b []byte) error {
var res Call
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,78 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CallWrapper call wrapper
// swagger:model CallWrapper
type CallWrapper struct {
// Call object.
// Required: true
Call *Call `json:"call"`
}
/* polymorph CallWrapper call false */
// Validate validates this call wrapper
func (m *CallWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCall(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CallWrapper) validateCall(formats strfmt.Registry) error {
if err := validate.Required("call", "body", m.Call); err != nil {
return err
}
if m.Call != nil {
if err := m.Call.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("call")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *CallWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CallWrapper) UnmarshalBinary(b []byte) error {
var res CallWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,117 @@
// 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"
"github.com/go-openapi/validate"
)
// CallsWrapper calls wrapper
// swagger:model CallsWrapper
type CallsWrapper struct {
// calls
// Required: true
Calls []*Call `json:"calls"`
// error
Error *ErrorBody `json:"error,omitempty"`
}
/* polymorph CallsWrapper calls false */
/* polymorph CallsWrapper error false */
// Validate validates this calls wrapper
func (m *CallsWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCalls(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateError(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CallsWrapper) validateCalls(formats strfmt.Registry) error {
if err := validate.Required("calls", "body", m.Calls); err != nil {
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
}
func (m *CallsWrapper) validateError(formats strfmt.Registry) error {
if swag.IsZero(m.Error) { // not required
return nil
}
if m.Error != nil {
if err := m.Error.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("error")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *CallsWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CallsWrapper) UnmarshalBinary(b []byte) error {
var res CallsWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

76
vendor/github.com/fnproject/fn_go/models/error.go generated vendored Normal file
View File

@@ -0,0 +1,76 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// Error error
// swagger:model Error
type Error struct {
// error
Error *ErrorBody `json:"error,omitempty"`
}
/* polymorph Error error false */
// Validate validates this error
func (m *Error) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateError(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Error) validateError(formats strfmt.Registry) error {
if swag.IsZero(m.Error) { // not required
return nil
}
if m.Error != nil {
if err := m.Error.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("error")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Error) UnmarshalBinary(b []byte) error {
var res Error
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

59
vendor/github.com/fnproject/fn_go/models/error_body.go generated vendored Normal file
View File

@@ -0,0 +1,59 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// ErrorBody error body
// swagger:model ErrorBody
type ErrorBody struct {
// fields
// Read Only: true
Fields string `json:"fields,omitempty"`
// message
// Read Only: true
Message string `json:"message,omitempty"`
}
/* polymorph ErrorBody fields false */
/* polymorph ErrorBody message false */
// Validate validates this error body
func (m *ErrorBody) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *ErrorBody) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ErrorBody) UnmarshalBinary(b []byte) error {
var res ErrorBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

57
vendor/github.com/fnproject/fn_go/models/log.go generated vendored Normal file
View File

@@ -0,0 +1,57 @@
// 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 (
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"`
}
/* polymorph Log call_id false */
/* polymorph Log log false */
// 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,78 @@
// 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 (
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"`
}
/* polymorph LogWrapper log false */
// 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
}

73
vendor/github.com/fnproject/fn_go/models/new_task.go generated vendored Normal file
View File

@@ -0,0 +1,73 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// NewTask new task
// swagger:model NewTask
type NewTask struct {
// 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"`
}
/* polymorph NewTask image false */
/* polymorph NewTask payload false */
// Validate validates this new task
func (m *NewTask) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateImage(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *NewTask) validateImage(formats strfmt.Registry) error {
if err := validate.Required("image", "body", m.Image); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *NewTask) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *NewTask) UnmarshalBinary(b []byte) error {
var res NewTask
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

208
vendor/github.com/fnproject/fn_go/models/route.go generated vendored Normal file
View File

@@ -0,0 +1,208 @@
// 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 (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Route route
// swagger:model Route
type Route struct {
// Route configuration - overrides application configuration
Config map[string]string `json:"config,omitempty"`
// Payload format sent into function.
Format string `json:"format,omitempty"`
// Map of http headers that will be sent with the response
Headers map[string][]string `json:"headers,omitempty"`
// Hot functions idle timeout before termination. Value in Seconds
IDLETimeout *int32 `json:"idle_timeout,omitempty"`
// 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"`
// Max usable memory for this route (MiB).
Memory uint64 `json:"memory,omitempty"`
// URL path that will be matched to this route
// Read Only: true
Path string `json:"path,omitempty"`
// Timeout for executions of this route. Value in Seconds
Timeout *int32 `json:"timeout,omitempty"`
// Route type
Type string `json:"type,omitempty"`
}
/* polymorph Route config false */
/* polymorph Route format false */
/* polymorph Route headers false */
/* polymorph Route idle_timeout false */
/* polymorph Route image false */
/* polymorph Route memory false */
/* polymorph Route path false */
/* polymorph Route timeout false */
/* polymorph Route type false */
// Validate validates this route
func (m *Route) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateFormat(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateHeaders(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateType(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var routeTypeFormatPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["default","http","json"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
routeTypeFormatPropEnum = append(routeTypeFormatPropEnum, v)
}
}
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
func (m *Route) validateFormatEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, routeTypeFormatPropEnum); err != nil {
return err
}
return nil
}
func (m *Route) validateFormat(formats strfmt.Registry) error {
if swag.IsZero(m.Format) { // not required
return nil
}
// value enum
if err := m.validateFormatEnum("format", "body", m.Format); err != nil {
return err
}
return nil
}
func (m *Route) validateHeaders(formats strfmt.Registry) error {
if swag.IsZero(m.Headers) { // not required
return nil
}
if swag.IsZero(m.Headers) { // not required
return nil
}
return nil
}
var routeTypeTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["sync","async"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
routeTypeTypePropEnum = append(routeTypeTypePropEnum, v)
}
}
const (
// RouteTypeSync captures enum value "sync"
RouteTypeSync string = "sync"
// RouteTypeAsync captures enum value "async"
RouteTypeAsync string = "async"
)
// prop value enum
func (m *Route) validateTypeEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, routeTypeTypePropEnum); err != nil {
return err
}
return nil
}
func (m *Route) validateType(formats strfmt.Registry) error {
if swag.IsZero(m.Type) { // not required
return nil
}
// value enum
if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *Route) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Route) UnmarshalBinary(b []byte) error {
var res Route
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,112 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// RouteWrapper route wrapper
// swagger:model RouteWrapper
type RouteWrapper struct {
// error
Error *ErrorBody `json:"error,omitempty"`
// message
Message string `json:"message,omitempty"`
// route
// Required: true
Route *Route `json:"route"`
}
/* polymorph RouteWrapper error false */
/* polymorph RouteWrapper message false */
/* polymorph RouteWrapper route false */
// Validate validates this route wrapper
func (m *RouteWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateError(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateRoute(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RouteWrapper) validateError(formats strfmt.Registry) error {
if swag.IsZero(m.Error) { // not required
return nil
}
if m.Error != nil {
if err := m.Error.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("error")
}
return err
}
}
return nil
}
func (m *RouteWrapper) validateRoute(formats strfmt.Registry) error {
if err := validate.Required("route", "body", m.Route); err != nil {
return err
}
if m.Route != nil {
if err := m.Route.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("route")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *RouteWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RouteWrapper) UnmarshalBinary(b []byte) error {
var res RouteWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,117 @@
// 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"
"github.com/go-openapi/validate"
)
// RoutesWrapper routes wrapper
// swagger:model RoutesWrapper
type RoutesWrapper struct {
// error
Error *ErrorBody `json:"error,omitempty"`
// routes
// Required: true
Routes []*Route `json:"routes"`
}
/* polymorph RoutesWrapper error false */
/* polymorph RoutesWrapper routes false */
// Validate validates this routes wrapper
func (m *RoutesWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateError(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateRoutes(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RoutesWrapper) validateError(formats strfmt.Registry) error {
if swag.IsZero(m.Error) { // not required
return nil
}
if m.Error != nil {
if err := m.Error.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("error")
}
return err
}
}
return nil
}
func (m *RoutesWrapper) validateRoutes(formats strfmt.Registry) error {
if err := validate.Required("routes", "body", m.Routes); err != nil {
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
}
// MarshalBinary interface implementation
func (m *RoutesWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RoutesWrapper) UnmarshalBinary(b []byte) error {
var res RoutesWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

238
vendor/github.com/fnproject/fn_go/models/task.go generated vendored Normal file
View File

@@ -0,0 +1,238 @@
// 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 (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Task task
// swagger:model Task
type Task struct {
NewTask
// Time when task completed, whether it was successul or failed. Always in UTC.
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
// Time when task was submitted. Always in UTC.
// Read Only: true
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
// Env vars for the task. Comes from the ones set on the Group.
EnvVars map[string]string `json:"env_vars,omitempty"`
// The error message, if status is 'error'. This is errors due to things outside the task itself. Errors from user code will be found in the log.
Error string `json:"error,omitempty"`
// Group this task belongs to.
// Read Only: true
GroupName string `json:"group_name,omitempty"`
// Machine usable reason for task being in this state.
// Valid values for error status are `timeout | killed | bad_exit`.
// Valid values for cancelled status are `client_request`.
// For everything else, this is undefined.
//
Reason string `json:"reason,omitempty"`
// If this field is set, then this task was retried by the task referenced in this field.
// Read Only: true
RetryAt string `json:"retry_at,omitempty"`
// If this field is set, then this task is a retry of the ID in this field.
// Read Only: true
RetryOf string `json:"retry_of,omitempty"`
// Time when task started execution. Always in UTC.
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
func (m *Task) Validate(formats strfmt.Registry) error {
var res []error
if err := m.NewTask.Validate(formats); err != nil {
res = append(res, err)
}
if err := m.validateReason(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var taskTypeReasonPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["timeout","killed","bad_exit","client_request"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
taskTypeReasonPropEnum = append(taskTypeReasonPropEnum, v)
}
}
// property enum
func (m *Task) validateReasonEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, taskTypeReasonPropEnum); err != nil {
return err
}
return nil
}
func (m *Task) validateReason(formats strfmt.Registry) error {
if swag.IsZero(m.Reason) { // not required
return nil
}
// value enum
if err := m.validateReasonEnum("reason", "body", m.Reason); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *Task) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Task) UnmarshalBinary(b []byte) error {
var res Task
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,78 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// TaskWrapper task wrapper
// swagger:model TaskWrapper
type TaskWrapper struct {
// task
// Required: true
Task *Task `json:"task"`
}
/* polymorph TaskWrapper task false */
// Validate validates this task wrapper
func (m *TaskWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTask(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TaskWrapper) validateTask(formats strfmt.Registry) error {
if err := validate.Required("task", "body", m.Task); err != nil {
return err
}
if m.Task != nil {
if err := m.Task.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("task")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *TaskWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TaskWrapper) UnmarshalBinary(b []byte) error {
var res TaskWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

53
vendor/github.com/fnproject/fn_go/models/version.go generated vendored Normal file
View File

@@ -0,0 +1,53 @@
// 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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// Version version
// swagger:model Version
type Version struct {
// version
// Read Only: true
Version string `json:"version,omitempty"`
}
/* polymorph Version version false */
// Validate validates this version
func (m *Version) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *Version) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Version) UnmarshalBinary(b []byte) error {
var res Version
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}