├── .gitignore ├── .travis.yml ├── Gopkg.lock ├── Gopkg.toml ├── LICENSE ├── README.md ├── apiv1swagger.json ├── cmd ├── kwsk-runtime-shim │ ├── Dockerfile.java8 │ ├── Dockerfile.nodejs6 │ ├── Dockerfile.nodejs8 │ ├── Dockerfile.python2 │ ├── Dockerfile.python3 │ ├── kwsk-wrapper.sh │ └── main.go └── kwsk-server │ └── main.go ├── models ├── action.go ├── action_exec.go ├── action_limits.go ├── action_payload.go ├── action_put.go ├── activation.go ├── activation_id.go ├── activation_ids.go ├── activation_info.go ├── activation_info_result.go ├── activation_logs.go ├── activation_result.go ├── activation_stderr.go ├── entity_brief.go ├── error_message.go ├── item_id.go ├── key_value.go ├── package.go ├── package_action.go ├── package_binding.go ├── package_put.go ├── path_name.go ├── principal.go ├── provider.go ├── provider_action.go ├── provider_binding.go ├── provider_trigger.go ├── rule.go ├── rule_put.go ├── set_state_params_body.go ├── trigger.go ├── trigger_limits.go ├── trigger_payload.go └── trigger_put.go ├── restapi ├── configure_kwsk.go ├── configure_kwsk_actions.go ├── configure_kwsk_activations.go ├── configure_kwsk_namespaces.go ├── configure_kwsk_packages.go ├── configure_kwsk_rules.go ├── configure_kwsk_triggers.go ├── doc.go ├── embedded_spec.go ├── operations │ ├── actions │ │ ├── delete_action.go │ │ ├── delete_action_in_package.go │ │ ├── delete_action_in_package_parameters.go │ │ ├── delete_action_in_package_responses.go │ │ ├── delete_action_in_package_urlbuilder.go │ │ ├── delete_action_parameters.go │ │ ├── delete_action_responses.go │ │ ├── delete_action_urlbuilder.go │ │ ├── delete_web_namespace_package_name_action_name_extension.go │ │ ├── delete_web_namespace_package_name_action_name_extension_parameters.go │ │ ├── delete_web_namespace_package_name_action_name_extension_responses.go │ │ ├── delete_web_namespace_package_name_action_name_extension_urlbuilder.go │ │ ├── get_action_by_name.go │ │ ├── get_action_by_name_parameters.go │ │ ├── get_action_by_name_responses.go │ │ ├── get_action_by_name_urlbuilder.go │ │ ├── get_action_in_package_by_name.go │ │ ├── get_action_in_package_by_name_parameters.go │ │ ├── get_action_in_package_by_name_responses.go │ │ ├── get_action_in_package_by_name_urlbuilder.go │ │ ├── get_all_actions.go │ │ ├── get_all_actions_parameters.go │ │ ├── get_all_actions_responses.go │ │ ├── get_all_actions_urlbuilder.go │ │ ├── get_web_namespace_package_name_action_name_extension.go │ │ ├── get_web_namespace_package_name_action_name_extension_parameters.go │ │ ├── get_web_namespace_package_name_action_name_extension_responses.go │ │ ├── get_web_namespace_package_name_action_name_extension_urlbuilder.go │ │ ├── invoke_action.go │ │ ├── invoke_action_in_package.go │ │ ├── invoke_action_in_package_parameters.go │ │ ├── invoke_action_in_package_responses.go │ │ ├── invoke_action_in_package_urlbuilder.go │ │ ├── invoke_action_parameters.go │ │ ├── invoke_action_responses.go │ │ ├── invoke_action_urlbuilder.go │ │ ├── post_web_namespace_package_name_action_name_extension.go │ │ ├── post_web_namespace_package_name_action_name_extension_parameters.go │ │ ├── post_web_namespace_package_name_action_name_extension_responses.go │ │ ├── post_web_namespace_package_name_action_name_extension_urlbuilder.go │ │ ├── put_web_namespace_package_name_action_name_extension.go │ │ ├── put_web_namespace_package_name_action_name_extension_parameters.go │ │ ├── put_web_namespace_package_name_action_name_extension_responses.go │ │ ├── put_web_namespace_package_name_action_name_extension_urlbuilder.go │ │ ├── update_action.go │ │ ├── update_action_in_package.go │ │ ├── update_action_in_package_parameters.go │ │ ├── update_action_in_package_responses.go │ │ ├── update_action_in_package_urlbuilder.go │ │ ├── update_action_parameters.go │ │ ├── update_action_responses.go │ │ └── update_action_urlbuilder.go │ ├── activations │ │ ├── get_activation_by_id.go │ │ ├── get_activation_by_id_parameters.go │ │ ├── get_activation_by_id_responses.go │ │ ├── get_activation_by_id_urlbuilder.go │ │ ├── get_activations.go │ │ ├── get_activations_parameters.go │ │ ├── get_activations_responses.go │ │ ├── get_activations_urlbuilder.go │ │ ├── get_namespaces_namespace_activations_activationid_logs.go │ │ ├── get_namespaces_namespace_activations_activationid_logs_parameters.go │ │ ├── get_namespaces_namespace_activations_activationid_logs_responses.go │ │ ├── get_namespaces_namespace_activations_activationid_logs_urlbuilder.go │ │ ├── get_namespaces_namespace_activations_activationid_result.go │ │ ├── get_namespaces_namespace_activations_activationid_result_parameters.go │ │ ├── get_namespaces_namespace_activations_activationid_result_responses.go │ │ └── get_namespaces_namespace_activations_activationid_result_urlbuilder.go │ ├── kwsk_api.go │ ├── namespaces │ │ ├── get_all_namespaces.go │ │ ├── get_all_namespaces_parameters.go │ │ ├── get_all_namespaces_responses.go │ │ └── get_all_namespaces_urlbuilder.go │ ├── packages │ │ ├── delete_package.go │ │ ├── delete_package_parameters.go │ │ ├── delete_package_responses.go │ │ ├── delete_package_urlbuilder.go │ │ ├── get_all_packages.go │ │ ├── get_all_packages_parameters.go │ │ ├── get_all_packages_responses.go │ │ ├── get_all_packages_urlbuilder.go │ │ ├── get_package_by_name.go │ │ ├── get_package_by_name_parameters.go │ │ ├── get_package_by_name_responses.go │ │ ├── get_package_by_name_urlbuilder.go │ │ ├── update_package.go │ │ ├── update_package_parameters.go │ │ ├── update_package_responses.go │ │ └── update_package_urlbuilder.go │ ├── rules │ │ ├── delete_rule.go │ │ ├── delete_rule_parameters.go │ │ ├── delete_rule_responses.go │ │ ├── delete_rule_urlbuilder.go │ │ ├── get_all_rules.go │ │ ├── get_all_rules_parameters.go │ │ ├── get_all_rules_responses.go │ │ ├── get_all_rules_urlbuilder.go │ │ ├── get_rule_by_name.go │ │ ├── get_rule_by_name_parameters.go │ │ ├── get_rule_by_name_responses.go │ │ ├── get_rule_by_name_urlbuilder.go │ │ ├── set_state.go │ │ ├── set_state_parameters.go │ │ ├── set_state_responses.go │ │ ├── set_state_urlbuilder.go │ │ ├── update_rule.go │ │ ├── update_rule_parameters.go │ │ ├── update_rule_responses.go │ │ └── update_rule_urlbuilder.go │ └── triggers │ │ ├── delete_trigger.go │ │ ├── delete_trigger_parameters.go │ │ ├── delete_trigger_responses.go │ │ ├── delete_trigger_urlbuilder.go │ │ ├── fire_trigger.go │ │ ├── fire_trigger_parameters.go │ │ ├── fire_trigger_responses.go │ │ ├── fire_trigger_urlbuilder.go │ │ ├── get_all_triggers.go │ │ ├── get_all_triggers_parameters.go │ │ ├── get_all_triggers_responses.go │ │ ├── get_all_triggers_urlbuilder.go │ │ ├── get_trigger_by_name.go │ │ ├── get_trigger_by_name_parameters.go │ │ ├── get_trigger_by_name_responses.go │ │ ├── get_trigger_by_name_urlbuilder.go │ │ ├── update_trigger.go │ │ ├── update_trigger_parameters.go │ │ ├── update_trigger_responses.go │ │ └── update_trigger_urlbuilder.go └── server.go └── test ├── bin ├── build-images.sh ├── integs.sh ├── knative-install.sh ├── kubeadm-dind-start.sh └── minikube-start.sh └── etc ├── action-nodejs.zip ├── action-python.zip ├── action.jar ├── openwhisk-server-cert.pem └── whisk.properties /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, build with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # dep vendor directory 15 | vendor/ 16 | /kwsk.log 17 | /test/openwhisk/ 18 | 19 | # built kwsk-runtime-shim binaries 20 | cmd/kwsk-runtime-shim/kwsk-runtime-shim 21 | cmd/kwsk-runtime-shim/kwsk-runtime-shim.cgo -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | # Gopkg.toml example 2 | # 3 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 4 | # for detailed Gopkg.toml documentation. 5 | # 6 | # required = ["github.com/user/thing/cmd/thing"] 7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 8 | # 9 | # [[constraint]] 10 | # name = "github.com/user/project" 11 | # version = "1.0.0" 12 | # 13 | # [[constraint]] 14 | # name = "github.com/user/project2" 15 | # branch = "dev" 16 | # source = "github.com/myfork/project2" 17 | # 18 | # [[override]] 19 | # name = "github.com/x/y" 20 | # version = "2.4.0" 21 | # 22 | # [prune] 23 | # non-go = false 24 | # go-tests = true 25 | # unused-packages = true 26 | 27 | 28 | required = [ 29 | "k8s.io/apimachinery/pkg/util/sets/types", 30 | ] 31 | 32 | 33 | [[constraint]] 34 | branch = "master" 35 | name = "github.com/go-openapi/errors" 36 | 37 | [[constraint]] 38 | branch = "master" 39 | name = "github.com/go-openapi/loads" 40 | 41 | [[constraint]] 42 | branch = "master" 43 | name = "github.com/go-openapi/runtime" 44 | 45 | [[constraint]] 46 | branch = "master" 47 | name = "github.com/go-openapi/spec" 48 | 49 | [[constraint]] 50 | branch = "master" 51 | name = "github.com/go-openapi/strfmt" 52 | 53 | [[constraint]] 54 | branch = "master" 55 | name = "github.com/go-openapi/swag" 56 | 57 | [[constraint]] 58 | branch = "master" 59 | name = "github.com/go-openapi/validate" 60 | 61 | [[constraint]] 62 | name = "github.com/jessevdk/go-flags" 63 | version = "1.4.0" 64 | 65 | [[constraint]] 66 | name = "github.com/tylerb/graceful" 67 | version = "1.2.15" 68 | 69 | [[constraint]] 70 | name = "k8s.io/apimachinery" 71 | version = "kubernetes-1.10.0" 72 | 73 | [[constraint]] 74 | name = "k8s.io/client-go" 75 | version = "kubernetes-1.10.0" 76 | 77 | [prune] 78 | go-tests = true 79 | unused-packages = true 80 | 81 | [[constraint]] 82 | branch = "master" 83 | name = "github.com/knative/serving" 84 | -------------------------------------------------------------------------------- /cmd/kwsk-runtime-shim/Dockerfile.java8: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk/openjdk8-openj9:jdk8u162-b12_openj9-0.8.0 2 | 3 | ARG OPENWHISK_RUNTIME_JAVA_VERSION="8@1.1.2" 4 | 5 | # Fetch upstream image source and put it where upstream expects it 6 | RUN curl -L -o java.tar.gz https://github.com/apache/incubator-openwhisk-runtime-java/archive/$OPENWHISK_RUNTIME_JAVA_VERSION.tar.gz \ 7 | && mkdir /upstream \ 8 | && tar --strip-components=1 -xf java.tar.gz -C /upstream \ 9 | && mkdir /javaAction \ 10 | && cp -R /upstream/core/java8/proxy/* /javaAction 11 | 12 | # Move the java server to port 8081 13 | RUN sed -ie "s/8080/8081/" /javaAction/src/main/java/openwhisk/java/action/Proxy.java 14 | 15 | ############ BEGIN upstream commands ############ 16 | RUN rm -rf /var/lib/apt/lists/* && apt-get clean && apt-get update \ 17 | && apt-get install -y --no-install-recommends locales \ 18 | && rm -rf /var/lib/apt/lists/* \ 19 | && locale-gen en_US.UTF-8 20 | ENV LANG="en_US.UTF-8" \ 21 | LANGUAGE="en_US:en" \ 22 | LC_ALL="en_US.UTF-8" \ 23 | VERSION=8 \ 24 | UPDATE=162 \ 25 | BUILD=12 26 | RUN cd /javaAction \ 27 | && rm -rf .classpath .gitignore .gradle .project .settings Dockerfile build \ 28 | && ./gradlew oneJar \ 29 | && rm -rf /javaAction/src \ 30 | && ./compileClassCache.sh 31 | ############ END upstream commands ############ 32 | 33 | # Add our new Golang server shim, which runs on port 8080 34 | COPY kwsk-runtime-shim /usr/local/bin/ 35 | 36 | # Add a little wrapper script that starts the shim and any other 37 | # command passed in its arguments 38 | COPY kwsk-wrapper.sh /usr/local/bin/ 39 | 40 | CMD ["kwsk-wrapper.sh", "java", "-Dfile.encoding=UTF-8", "-Xshareclasses:cacheDir=/javaSharedCache,readonly", "-Xquickstart", "-jar", "/javaAction/build/libs/javaAction-all.jar"] 41 | -------------------------------------------------------------------------------- /cmd/kwsk-runtime-shim/Dockerfile.nodejs6: -------------------------------------------------------------------------------- 1 | FROM openwhisk/nodejs6action 2 | 3 | # Move the node server to port 8081 4 | RUN sed -ie "s/8080/8081/" app.js 5 | 6 | # Add our new Golang server shim, which runs on port 8080 7 | COPY kwsk-runtime-shim /usr/local/bin/ 8 | 9 | # Add a little wrapper script that starts the shim and any other 10 | # command passed in its arguments 11 | COPY kwsk-wrapper.sh /usr/local/bin/ 12 | 13 | CMD kwsk-wrapper.sh node --expose-gc app.js 14 | -------------------------------------------------------------------------------- /cmd/kwsk-runtime-shim/Dockerfile.nodejs8: -------------------------------------------------------------------------------- 1 | FROM openwhisk/action-nodejs-v8 2 | 3 | # Move the node server to port 8081 4 | RUN sed -ie "s/8080/8081/" app.js 5 | 6 | # Add our new Golang server shim, which runs on port 8080 7 | COPY kwsk-runtime-shim /usr/local/bin/ 8 | 9 | # Add a little wrapper script that starts the shim and any other 10 | # command passed in its arguments 11 | COPY kwsk-wrapper.sh /usr/local/bin/ 12 | 13 | CMD kwsk-wrapper.sh node --expose-gc app.js 14 | -------------------------------------------------------------------------------- /cmd/kwsk-runtime-shim/Dockerfile.python2: -------------------------------------------------------------------------------- 1 | FROM openwhisk/python2action 2 | 3 | # Move the python server to port 8081 4 | ENV FLASK_PROXY_PORT 8081 5 | 6 | # Add our new Golang server shim, which runs on port 8080 7 | COPY kwsk-runtime-shim.cgo /usr/local/bin/kwsk-runtime-shim 8 | 9 | # Add a little wrapper script that starts the shim and any other 10 | # command passed in its arguments 11 | COPY kwsk-wrapper.sh /usr/local/bin/ 12 | 13 | CMD ["/bin/bash", "-c", "cd pythonAction && kwsk-wrapper.sh python -u pythonrunner.py"] 14 | -------------------------------------------------------------------------------- /cmd/kwsk-runtime-shim/Dockerfile.python3: -------------------------------------------------------------------------------- 1 | FROM openwhisk/python3action 2 | 3 | # Move the python server to port 8081 4 | ENV FLASK_PROXY_PORT 8081 5 | 6 | # Add our new Golang server shim, which runs on port 8080 7 | COPY kwsk-runtime-shim.cgo /usr/local/bin/kwsk-runtime-shim 8 | 9 | # Add a little wrapper script that starts the shim and any other 10 | # command passed in its arguments 11 | COPY kwsk-wrapper.sh /usr/local/bin/ 12 | 13 | CMD ["/bin/bash", "-c", "cd pythonAction && kwsk-wrapper.sh python -u pythonrunner.py"] 14 | -------------------------------------------------------------------------------- /cmd/kwsk-runtime-shim/kwsk-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Start the runtime shim 4 | echo "Starting shim" 5 | kwsk-runtime-shim & 6 | status=$? 7 | echo "Shim Status: ${status}" 8 | shim_pid=$! 9 | echo "Shim PID: ${shim_pid}" 10 | if [ $status -ne 0 ]; then 11 | echo "Failed to start runtime shim" 12 | exit $status 13 | fi 14 | 15 | # Start the regular server 16 | echo "Starting server: $@" 17 | "$@" & 18 | status=$? 19 | echo "Server Status: ${status}" 20 | server_pid=$! 21 | echo "Server PID: ${server_pid}" 22 | if [ $status -ne 0 ]; then 23 | echo "Failed to start server" 24 | exit $status 25 | fi 26 | 27 | while sleep 10; do 28 | ps | grep ${shim_pid} | grep -q -v grep 29 | shim_status=$? 30 | ps | grep ${server_pid} | grep -q -v grep 31 | server_status=$? 32 | if [ $shim_status -ne 0 -o $server_status -ne 0 ]; then 33 | echo "ERROR: shim or server process has terminated." 34 | kill $shim_pid 35 | kill $server_pid 36 | exit 1 37 | fi 38 | done 39 | -------------------------------------------------------------------------------- /cmd/kwsk-server/main.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "log" 7 | "os" 8 | 9 | loads "github.com/go-openapi/loads" 10 | flags "github.com/jessevdk/go-flags" 11 | 12 | "github.com/projectodd/kwsk/restapi" 13 | "github.com/projectodd/kwsk/restapi/operations" 14 | ) 15 | 16 | // This file was generated by the swagger tool. 17 | // Make sure not to overwrite this file after you generated it because all your edits would be lost! 18 | 19 | func main() { 20 | 21 | swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON) 22 | if err != nil { 23 | log.Fatalln(err) 24 | } 25 | 26 | api := operations.NewKwskAPI(swaggerSpec) 27 | server := restapi.NewServer(api) 28 | defer server.Shutdown() 29 | 30 | parser := flags.NewParser(server, flags.Default) 31 | parser.ShortDescription = "OpenWhisk REST API" 32 | parser.LongDescription = "API for OpenWhisk" 33 | 34 | server.ConfigureFlags() 35 | for _, optsGroup := range api.CommandLineOptionsGroups { 36 | _, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options) 37 | if err != nil { 38 | log.Fatalln(err) 39 | } 40 | } 41 | 42 | if _, err := parser.Parse(); err != nil { 43 | code := 1 44 | if fe, ok := err.(*flags.Error); ok { 45 | if fe.Type == flags.ErrHelp { 46 | code = 0 47 | } 48 | } 49 | os.Exit(code) 50 | } 51 | 52 | server.ConfigureAPI() 53 | 54 | if err := server.Serve(); err != nil { 55 | log.Fatalln(err) 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /models/action_limits.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/swag" 12 | ) 13 | 14 | // ActionLimits Limits on a specific action 15 | // swagger:model ActionLimits 16 | type ActionLimits struct { 17 | 18 | // log size in megabytes 19 | Logs *int32 `json:"logs,omitempty"` 20 | 21 | // memory in megabytes 22 | Memory *int32 `json:"memory,omitempty"` 23 | 24 | // timeout in milliseconds 25 | Timeout *int32 `json:"timeout,omitempty"` 26 | } 27 | 28 | // Validate validates this action limits 29 | func (m *ActionLimits) Validate(formats strfmt.Registry) error { 30 | return nil 31 | } 32 | 33 | // MarshalBinary interface implementation 34 | func (m *ActionLimits) MarshalBinary() ([]byte, error) { 35 | if m == nil { 36 | return nil, nil 37 | } 38 | return swag.WriteJSON(m) 39 | } 40 | 41 | // UnmarshalBinary interface implementation 42 | func (m *ActionLimits) UnmarshalBinary(b []byte) error { 43 | var res ActionLimits 44 | if err := swag.ReadJSON(b, &res); err != nil { 45 | return err 46 | } 47 | *m = res 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /models/action_payload.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ActionPayload action payload 17 | // swagger:model ActionPayload 18 | type ActionPayload struct { 19 | 20 | // The payload to pass to the action. 21 | // Required: true 22 | Payload *string `json:"payload"` 23 | } 24 | 25 | // Validate validates this action payload 26 | func (m *ActionPayload) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validatePayload(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *ActionPayload) validatePayload(formats strfmt.Registry) error { 40 | 41 | if err := validate.Required("payload", "body", m.Payload); err != nil { 42 | return err 43 | } 44 | 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *ActionPayload) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *ActionPayload) UnmarshalBinary(b []byte) error { 58 | var res ActionPayload 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /models/activation_id.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ActivationID activation Id 17 | // swagger:model ActivationId 18 | type ActivationID struct { 19 | 20 | // activation Id 21 | // Required: true 22 | ActivationID *string `json:"activationId"` 23 | } 24 | 25 | // Validate validates this activation Id 26 | func (m *ActivationID) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validateActivationID(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *ActivationID) validateActivationID(formats strfmt.Registry) error { 40 | 41 | if err := validate.Required("activationId", "body", m.ActivationID); err != nil { 42 | return err 43 | } 44 | 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *ActivationID) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *ActivationID) UnmarshalBinary(b []byte) error { 58 | var res ActivationID 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /models/activation_ids.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "strconv" 10 | 11 | strfmt "github.com/go-openapi/strfmt" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/swag" 15 | ) 16 | 17 | // ActivationIds activation ids 18 | // swagger:model ActivationIds 19 | type ActivationIds struct { 20 | 21 | // Array of activation ids 22 | Ids []*ActivationID `json:"ids"` 23 | } 24 | 25 | // Validate validates this activation ids 26 | func (m *ActivationIds) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validateIds(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *ActivationIds) validateIds(formats strfmt.Registry) error { 40 | 41 | if swag.IsZero(m.Ids) { // not required 42 | return nil 43 | } 44 | 45 | for i := 0; i < len(m.Ids); i++ { 46 | if swag.IsZero(m.Ids[i]) { // not required 47 | continue 48 | } 49 | 50 | if m.Ids[i] != nil { 51 | if err := m.Ids[i].Validate(formats); err != nil { 52 | if ve, ok := err.(*errors.Validation); ok { 53 | return ve.ValidateName("ids" + "." + strconv.Itoa(i)) 54 | } 55 | return err 56 | } 57 | } 58 | 59 | } 60 | 61 | return nil 62 | } 63 | 64 | // MarshalBinary interface implementation 65 | func (m *ActivationIds) MarshalBinary() ([]byte, error) { 66 | if m == nil { 67 | return nil, nil 68 | } 69 | return swag.WriteJSON(m) 70 | } 71 | 72 | // UnmarshalBinary interface implementation 73 | func (m *ActivationIds) UnmarshalBinary(b []byte) error { 74 | var res ActivationIds 75 | if err := swag.ReadJSON(b, &res); err != nil { 76 | return err 77 | } 78 | *m = res 79 | return nil 80 | } 81 | -------------------------------------------------------------------------------- /models/activation_info.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ActivationInfo activation info 17 | // swagger:model ActivationInfo 18 | type ActivationInfo struct { 19 | 20 | // Activation id 21 | // Min Length: 1 22 | ID string `json:"id,omitempty"` 23 | 24 | // result 25 | Result *ActivationInfoResult `json:"result,omitempty"` 26 | 27 | // Standard error from activation 28 | Stderr string `json:"stderr,omitempty"` 29 | 30 | // Standard output from activation 31 | Stdout string `json:"stdout,omitempty"` 32 | } 33 | 34 | // Validate validates this activation info 35 | func (m *ActivationInfo) Validate(formats strfmt.Registry) error { 36 | var res []error 37 | 38 | if err := m.validateID(formats); err != nil { 39 | res = append(res, err) 40 | } 41 | 42 | if err := m.validateResult(formats); err != nil { 43 | res = append(res, err) 44 | } 45 | 46 | if len(res) > 0 { 47 | return errors.CompositeValidationError(res...) 48 | } 49 | return nil 50 | } 51 | 52 | func (m *ActivationInfo) validateID(formats strfmt.Registry) error { 53 | 54 | if swag.IsZero(m.ID) { // not required 55 | return nil 56 | } 57 | 58 | if err := validate.MinLength("id", "body", string(m.ID), 1); err != nil { 59 | return err 60 | } 61 | 62 | return nil 63 | } 64 | 65 | func (m *ActivationInfo) validateResult(formats strfmt.Registry) error { 66 | 67 | if swag.IsZero(m.Result) { // not required 68 | return nil 69 | } 70 | 71 | if m.Result != nil { 72 | if err := m.Result.Validate(formats); err != nil { 73 | if ve, ok := err.(*errors.Validation); ok { 74 | return ve.ValidateName("result") 75 | } 76 | return err 77 | } 78 | } 79 | 80 | return nil 81 | } 82 | 83 | // MarshalBinary interface implementation 84 | func (m *ActivationInfo) MarshalBinary() ([]byte, error) { 85 | if m == nil { 86 | return nil, nil 87 | } 88 | return swag.WriteJSON(m) 89 | } 90 | 91 | // UnmarshalBinary interface implementation 92 | func (m *ActivationInfo) UnmarshalBinary(b []byte) error { 93 | var res ActivationInfo 94 | if err := swag.ReadJSON(b, &res); err != nil { 95 | return err 96 | } 97 | *m = res 98 | return nil 99 | } 100 | -------------------------------------------------------------------------------- /models/activation_info_result.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ActivationInfoResult Activation result 17 | // swagger:model activationInfoResult 18 | type ActivationInfoResult struct { 19 | 20 | // status 21 | // Required: true 22 | Status *string `json:"status"` 23 | } 24 | 25 | // Validate validates this activation info result 26 | func (m *ActivationInfoResult) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validateStatus(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *ActivationInfoResult) validateStatus(formats strfmt.Registry) error { 40 | 41 | if err := validate.Required("status", "body", m.Status); err != nil { 42 | return err 43 | } 44 | 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *ActivationInfoResult) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *ActivationInfoResult) UnmarshalBinary(b []byte) error { 58 | var res ActivationInfoResult 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /models/activation_logs.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/swag" 12 | ) 13 | 14 | // ActivationLogs activation logs 15 | // swagger:model ActivationLogs 16 | type ActivationLogs struct { 17 | 18 | // Interleaved standard output and error of an activation 19 | Logs []string `json:"logs"` 20 | } 21 | 22 | // Validate validates this activation logs 23 | func (m *ActivationLogs) Validate(formats strfmt.Registry) error { 24 | return nil 25 | } 26 | 27 | // MarshalBinary interface implementation 28 | func (m *ActivationLogs) MarshalBinary() ([]byte, error) { 29 | if m == nil { 30 | return nil, nil 31 | } 32 | return swag.WriteJSON(m) 33 | } 34 | 35 | // UnmarshalBinary interface implementation 36 | func (m *ActivationLogs) UnmarshalBinary(b []byte) error { 37 | var res ActivationLogs 38 | if err := swag.ReadJSON(b, &res); err != nil { 39 | return err 40 | } 41 | *m = res 42 | return nil 43 | } 44 | -------------------------------------------------------------------------------- /models/activation_result.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/swag" 12 | ) 13 | 14 | // ActivationResult activation result 15 | // swagger:model ActivationResult 16 | type ActivationResult struct { 17 | 18 | // The return value from the activation 19 | Result interface{} `json:"result,omitempty"` 20 | 21 | // Exit status of the activation 22 | Status string `json:"status,omitempty"` 23 | 24 | // Whether the activation was successful or not 25 | Success bool `json:"success,omitempty"` 26 | } 27 | 28 | // Validate validates this activation result 29 | func (m *ActivationResult) Validate(formats strfmt.Registry) error { 30 | return nil 31 | } 32 | 33 | // MarshalBinary interface implementation 34 | func (m *ActivationResult) MarshalBinary() ([]byte, error) { 35 | if m == nil { 36 | return nil, nil 37 | } 38 | return swag.WriteJSON(m) 39 | } 40 | 41 | // UnmarshalBinary interface implementation 42 | func (m *ActivationResult) UnmarshalBinary(b []byte) error { 43 | var res ActivationResult 44 | if err := swag.ReadJSON(b, &res); err != nil { 45 | return err 46 | } 47 | *m = res 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /models/activation_stderr.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/swag" 12 | ) 13 | 14 | // ActivationStderr activation stderr 15 | // swagger:model ActivationStderr 16 | type ActivationStderr struct { 17 | 18 | // Standard error of an activation 19 | Stderr string `json:"stderr,omitempty"` 20 | } 21 | 22 | // Validate validates this activation stderr 23 | func (m *ActivationStderr) Validate(formats strfmt.Registry) error { 24 | return nil 25 | } 26 | 27 | // MarshalBinary interface implementation 28 | func (m *ActivationStderr) MarshalBinary() ([]byte, error) { 29 | if m == nil { 30 | return nil, nil 31 | } 32 | return swag.WriteJSON(m) 33 | } 34 | 35 | // UnmarshalBinary interface implementation 36 | func (m *ActivationStderr) UnmarshalBinary(b []byte) error { 37 | var res ActivationStderr 38 | if err := swag.ReadJSON(b, &res); err != nil { 39 | return err 40 | } 41 | *m = res 42 | return nil 43 | } 44 | -------------------------------------------------------------------------------- /models/entity_brief.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // EntityBrief entity brief 17 | // swagger:model EntityBrief 18 | type EntityBrief struct { 19 | 20 | // Name of the item 21 | // Required: true 22 | // Min Length: 1 23 | Name *string `json:"name"` 24 | 25 | // Namespace of the item 26 | // Required: true 27 | // Min Length: 1 28 | Namespace *string `json:"namespace"` 29 | 30 | // Whether to publish the item or not 31 | // Required: true 32 | Publish *bool `json:"publish"` 33 | 34 | // Semantic version of the item 35 | // Required: true 36 | // Min Length: 1 37 | Version *string `json:"version"` 38 | } 39 | 40 | // Validate validates this entity brief 41 | func (m *EntityBrief) Validate(formats strfmt.Registry) error { 42 | var res []error 43 | 44 | if err := m.validateName(formats); err != nil { 45 | res = append(res, err) 46 | } 47 | 48 | if err := m.validateNamespace(formats); err != nil { 49 | res = append(res, err) 50 | } 51 | 52 | if err := m.validatePublish(formats); err != nil { 53 | res = append(res, err) 54 | } 55 | 56 | if err := m.validateVersion(formats); err != nil { 57 | res = append(res, err) 58 | } 59 | 60 | if len(res) > 0 { 61 | return errors.CompositeValidationError(res...) 62 | } 63 | return nil 64 | } 65 | 66 | func (m *EntityBrief) validateName(formats strfmt.Registry) error { 67 | 68 | if err := validate.Required("name", "body", m.Name); err != nil { 69 | return err 70 | } 71 | 72 | if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { 73 | return err 74 | } 75 | 76 | return nil 77 | } 78 | 79 | func (m *EntityBrief) validateNamespace(formats strfmt.Registry) error { 80 | 81 | if err := validate.Required("namespace", "body", m.Namespace); err != nil { 82 | return err 83 | } 84 | 85 | if err := validate.MinLength("namespace", "body", string(*m.Namespace), 1); err != nil { 86 | return err 87 | } 88 | 89 | return nil 90 | } 91 | 92 | func (m *EntityBrief) validatePublish(formats strfmt.Registry) error { 93 | 94 | if err := validate.Required("publish", "body", m.Publish); err != nil { 95 | return err 96 | } 97 | 98 | return nil 99 | } 100 | 101 | func (m *EntityBrief) validateVersion(formats strfmt.Registry) error { 102 | 103 | if err := validate.Required("version", "body", m.Version); err != nil { 104 | return err 105 | } 106 | 107 | if err := validate.MinLength("version", "body", string(*m.Version), 1); err != nil { 108 | return err 109 | } 110 | 111 | return nil 112 | } 113 | 114 | // MarshalBinary interface implementation 115 | func (m *EntityBrief) MarshalBinary() ([]byte, error) { 116 | if m == nil { 117 | return nil, nil 118 | } 119 | return swag.WriteJSON(m) 120 | } 121 | 122 | // UnmarshalBinary interface implementation 123 | func (m *EntityBrief) UnmarshalBinary(b []byte) error { 124 | var res EntityBrief 125 | if err := swag.ReadJSON(b, &res); err != nil { 126 | return err 127 | } 128 | *m = res 129 | return nil 130 | } 131 | -------------------------------------------------------------------------------- /models/error_message.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ErrorMessage error message 17 | // swagger:model ErrorMessage 18 | type ErrorMessage struct { 19 | 20 | // code 21 | Code string `json:"code,omitempty"` 22 | 23 | // error 24 | // Required: true 25 | Error *string `json:"error"` 26 | } 27 | 28 | // Validate validates this error message 29 | func (m *ErrorMessage) Validate(formats strfmt.Registry) error { 30 | var res []error 31 | 32 | if err := m.validateError(formats); err != nil { 33 | res = append(res, err) 34 | } 35 | 36 | if len(res) > 0 { 37 | return errors.CompositeValidationError(res...) 38 | } 39 | return nil 40 | } 41 | 42 | func (m *ErrorMessage) validateError(formats strfmt.Registry) error { 43 | 44 | if err := validate.Required("error", "body", m.Error); err != nil { 45 | return err 46 | } 47 | 48 | return nil 49 | } 50 | 51 | // MarshalBinary interface implementation 52 | func (m *ErrorMessage) MarshalBinary() ([]byte, error) { 53 | if m == nil { 54 | return nil, nil 55 | } 56 | return swag.WriteJSON(m) 57 | } 58 | 59 | // UnmarshalBinary interface implementation 60 | func (m *ErrorMessage) UnmarshalBinary(b []byte) error { 61 | var res ErrorMessage 62 | if err := swag.ReadJSON(b, &res); err != nil { 63 | return err 64 | } 65 | *m = res 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /models/item_id.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ItemID item Id 17 | // swagger:model ItemId 18 | type ItemID struct { 19 | 20 | // id 21 | // Required: true 22 | ID *string `json:"id"` 23 | } 24 | 25 | // Validate validates this item Id 26 | func (m *ItemID) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validateID(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *ItemID) validateID(formats strfmt.Registry) error { 40 | 41 | if err := validate.Required("id", "body", m.ID); err != nil { 42 | return err 43 | } 44 | 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *ItemID) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *ItemID) UnmarshalBinary(b []byte) error { 58 | var res ItemID 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /models/key_value.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/swag" 12 | ) 13 | 14 | // KeyValue key value 15 | // swagger:model KeyValue 16 | type KeyValue struct { 17 | 18 | // key 19 | Key string `json:"key,omitempty"` 20 | 21 | // Any JSON value 22 | Value interface{} `json:"value,omitempty"` 23 | } 24 | 25 | // Validate validates this key value 26 | func (m *KeyValue) Validate(formats strfmt.Registry) error { 27 | return nil 28 | } 29 | 30 | // MarshalBinary interface implementation 31 | func (m *KeyValue) MarshalBinary() ([]byte, error) { 32 | if m == nil { 33 | return nil, nil 34 | } 35 | return swag.WriteJSON(m) 36 | } 37 | 38 | // UnmarshalBinary interface implementation 39 | func (m *KeyValue) UnmarshalBinary(b []byte) error { 40 | var res KeyValue 41 | if err := swag.ReadJSON(b, &res); err != nil { 42 | return err 43 | } 44 | *m = res 45 | return nil 46 | } 47 | -------------------------------------------------------------------------------- /models/package_binding.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/swag" 12 | ) 13 | 14 | // PackageBinding package binding 15 | // swagger:model PackageBinding 16 | type PackageBinding struct { 17 | 18 | // Name of the item 19 | Name string `json:"name,omitempty"` 20 | 21 | // Namespace of the item 22 | Namespace string `json:"namespace,omitempty"` 23 | } 24 | 25 | // Validate validates this package binding 26 | func (m *PackageBinding) Validate(formats strfmt.Registry) error { 27 | return nil 28 | } 29 | 30 | // MarshalBinary interface implementation 31 | func (m *PackageBinding) MarshalBinary() ([]byte, error) { 32 | if m == nil { 33 | return nil, nil 34 | } 35 | return swag.WriteJSON(m) 36 | } 37 | 38 | // UnmarshalBinary interface implementation 39 | func (m *PackageBinding) UnmarshalBinary(b []byte) error { 40 | var res PackageBinding 41 | if err := swag.ReadJSON(b, &res); err != nil { 42 | return err 43 | } 44 | *m = res 45 | return nil 46 | } 47 | -------------------------------------------------------------------------------- /models/path_name.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // PathName path name 17 | // swagger:model PathName 18 | type PathName struct { 19 | 20 | // name 21 | // Required: true 22 | Name *string `json:"name"` 23 | 24 | // path 25 | // Required: true 26 | Path *string `json:"path"` 27 | } 28 | 29 | // Validate validates this path name 30 | func (m *PathName) Validate(formats strfmt.Registry) error { 31 | var res []error 32 | 33 | if err := m.validateName(formats); err != nil { 34 | res = append(res, err) 35 | } 36 | 37 | if err := m.validatePath(formats); err != nil { 38 | res = append(res, err) 39 | } 40 | 41 | if len(res) > 0 { 42 | return errors.CompositeValidationError(res...) 43 | } 44 | return nil 45 | } 46 | 47 | func (m *PathName) validateName(formats strfmt.Registry) error { 48 | 49 | if err := validate.Required("name", "body", m.Name); err != nil { 50 | return err 51 | } 52 | 53 | return nil 54 | } 55 | 56 | func (m *PathName) validatePath(formats strfmt.Registry) error { 57 | 58 | if err := validate.Required("path", "body", m.Path); err != nil { 59 | return err 60 | } 61 | 62 | return nil 63 | } 64 | 65 | // MarshalBinary interface implementation 66 | func (m *PathName) MarshalBinary() ([]byte, error) { 67 | if m == nil { 68 | return nil, nil 69 | } 70 | return swag.WriteJSON(m) 71 | } 72 | 73 | // UnmarshalBinary interface implementation 74 | func (m *PathName) UnmarshalBinary(b []byte) error { 75 | var res PathName 76 | if err := swag.ReadJSON(b, &res); err != nil { 77 | return err 78 | } 79 | *m = res 80 | return nil 81 | } 82 | -------------------------------------------------------------------------------- /models/principal.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | ) 11 | 12 | // Principal principal 13 | // swagger:model Principal 14 | type Principal string 15 | 16 | // Validate validates this principal 17 | func (m Principal) Validate(formats strfmt.Registry) error { 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /models/provider.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "strconv" 10 | 11 | strfmt "github.com/go-openapi/strfmt" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/swag" 15 | "github.com/go-openapi/validate" 16 | ) 17 | 18 | // Provider provider 19 | // swagger:model Provider 20 | type Provider struct { 21 | 22 | // Name of the provider 23 | // Required: true 24 | // Min Length: 1 25 | Name *string `json:"name"` 26 | 27 | // parameter bindings included in the context passed to the provider 28 | Parameters []*KeyValue `json:"parameters"` 29 | 30 | // Whether to publish the provider or not 31 | Publish bool `json:"publish,omitempty"` 32 | } 33 | 34 | // Validate validates this provider 35 | func (m *Provider) Validate(formats strfmt.Registry) error { 36 | var res []error 37 | 38 | if err := m.validateName(formats); err != nil { 39 | res = append(res, err) 40 | } 41 | 42 | if err := m.validateParameters(formats); err != nil { 43 | res = append(res, err) 44 | } 45 | 46 | if len(res) > 0 { 47 | return errors.CompositeValidationError(res...) 48 | } 49 | return nil 50 | } 51 | 52 | func (m *Provider) validateName(formats strfmt.Registry) error { 53 | 54 | if err := validate.Required("name", "body", m.Name); err != nil { 55 | return err 56 | } 57 | 58 | if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { 59 | return err 60 | } 61 | 62 | return nil 63 | } 64 | 65 | func (m *Provider) validateParameters(formats strfmt.Registry) error { 66 | 67 | if swag.IsZero(m.Parameters) { // not required 68 | return nil 69 | } 70 | 71 | for i := 0; i < len(m.Parameters); i++ { 72 | if swag.IsZero(m.Parameters[i]) { // not required 73 | continue 74 | } 75 | 76 | if m.Parameters[i] != nil { 77 | if err := m.Parameters[i].Validate(formats); err != nil { 78 | if ve, ok := err.(*errors.Validation); ok { 79 | return ve.ValidateName("parameters" + "." + strconv.Itoa(i)) 80 | } 81 | return err 82 | } 83 | } 84 | 85 | } 86 | 87 | return nil 88 | } 89 | 90 | // MarshalBinary interface implementation 91 | func (m *Provider) MarshalBinary() ([]byte, error) { 92 | if m == nil { 93 | return nil, nil 94 | } 95 | return swag.WriteJSON(m) 96 | } 97 | 98 | // UnmarshalBinary interface implementation 99 | func (m *Provider) UnmarshalBinary(b []byte) error { 100 | var res Provider 101 | if err := swag.ReadJSON(b, &res); err != nil { 102 | return err 103 | } 104 | *m = res 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /models/provider_action.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ProviderAction provider action 17 | // swagger:model ProviderAction 18 | type ProviderAction struct { 19 | 20 | // Name of the action 21 | // Required: true 22 | // Min Length: 1 23 | Name *string `json:"name"` 24 | } 25 | 26 | // Validate validates this provider action 27 | func (m *ProviderAction) Validate(formats strfmt.Registry) error { 28 | var res []error 29 | 30 | if err := m.validateName(formats); err != nil { 31 | res = append(res, err) 32 | } 33 | 34 | if len(res) > 0 { 35 | return errors.CompositeValidationError(res...) 36 | } 37 | return nil 38 | } 39 | 40 | func (m *ProviderAction) validateName(formats strfmt.Registry) error { 41 | 42 | if err := validate.Required("name", "body", m.Name); err != nil { 43 | return err 44 | } 45 | 46 | if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { 47 | return err 48 | } 49 | 50 | return nil 51 | } 52 | 53 | // MarshalBinary interface implementation 54 | func (m *ProviderAction) MarshalBinary() ([]byte, error) { 55 | if m == nil { 56 | return nil, nil 57 | } 58 | return swag.WriteJSON(m) 59 | } 60 | 61 | // UnmarshalBinary interface implementation 62 | func (m *ProviderAction) UnmarshalBinary(b []byte) error { 63 | var res ProviderAction 64 | if err := swag.ReadJSON(b, &res); err != nil { 65 | return err 66 | } 67 | *m = res 68 | return nil 69 | } 70 | -------------------------------------------------------------------------------- /models/provider_binding.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ProviderBinding provider binding 17 | // swagger:model ProviderBinding 18 | type ProviderBinding struct { 19 | 20 | // Name of the binding 21 | // Required: true 22 | // Min Length: 1 23 | Name *string `json:"name"` 24 | } 25 | 26 | // Validate validates this provider binding 27 | func (m *ProviderBinding) Validate(formats strfmt.Registry) error { 28 | var res []error 29 | 30 | if err := m.validateName(formats); err != nil { 31 | res = append(res, err) 32 | } 33 | 34 | if len(res) > 0 { 35 | return errors.CompositeValidationError(res...) 36 | } 37 | return nil 38 | } 39 | 40 | func (m *ProviderBinding) validateName(formats strfmt.Registry) error { 41 | 42 | if err := validate.Required("name", "body", m.Name); err != nil { 43 | return err 44 | } 45 | 46 | if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { 47 | return err 48 | } 49 | 50 | return nil 51 | } 52 | 53 | // MarshalBinary interface implementation 54 | func (m *ProviderBinding) MarshalBinary() ([]byte, error) { 55 | if m == nil { 56 | return nil, nil 57 | } 58 | return swag.WriteJSON(m) 59 | } 60 | 61 | // UnmarshalBinary interface implementation 62 | func (m *ProviderBinding) UnmarshalBinary(b []byte) error { 63 | var res ProviderBinding 64 | if err := swag.ReadJSON(b, &res); err != nil { 65 | return err 66 | } 67 | *m = res 68 | return nil 69 | } 70 | -------------------------------------------------------------------------------- /models/provider_trigger.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // ProviderTrigger provider trigger 17 | // swagger:model ProviderTrigger 18 | type ProviderTrigger struct { 19 | 20 | // Name of the trigger 21 | // Required: true 22 | // Min Length: 1 23 | Name *string `json:"name"` 24 | } 25 | 26 | // Validate validates this provider trigger 27 | func (m *ProviderTrigger) Validate(formats strfmt.Registry) error { 28 | var res []error 29 | 30 | if err := m.validateName(formats); err != nil { 31 | res = append(res, err) 32 | } 33 | 34 | if len(res) > 0 { 35 | return errors.CompositeValidationError(res...) 36 | } 37 | return nil 38 | } 39 | 40 | func (m *ProviderTrigger) validateName(formats strfmt.Registry) error { 41 | 42 | if err := validate.Required("name", "body", m.Name); err != nil { 43 | return err 44 | } 45 | 46 | if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { 47 | return err 48 | } 49 | 50 | return nil 51 | } 52 | 53 | // MarshalBinary interface implementation 54 | func (m *ProviderTrigger) MarshalBinary() ([]byte, error) { 55 | if m == nil { 56 | return nil, nil 57 | } 58 | return swag.WriteJSON(m) 59 | } 60 | 61 | // UnmarshalBinary interface implementation 62 | func (m *ProviderTrigger) UnmarshalBinary(b []byte) error { 63 | var res ProviderTrigger 64 | if err := swag.ReadJSON(b, &res); err != nil { 65 | return err 66 | } 67 | *m = res 68 | return nil 69 | } 70 | -------------------------------------------------------------------------------- /models/set_state_params_body.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "encoding/json" 10 | 11 | strfmt "github.com/go-openapi/strfmt" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/swag" 15 | "github.com/go-openapi/validate" 16 | ) 17 | 18 | // SetStateParamsBody set state params body 19 | // swagger:model setStateParamsBody 20 | type SetStateParamsBody struct { 21 | 22 | // status 23 | // Required: true 24 | // Enum: [inactive active] 25 | Status *string `json:"status"` 26 | } 27 | 28 | // Validate validates this set state params body 29 | func (m *SetStateParamsBody) Validate(formats strfmt.Registry) error { 30 | var res []error 31 | 32 | if err := m.validateStatus(formats); err != nil { 33 | res = append(res, err) 34 | } 35 | 36 | if len(res) > 0 { 37 | return errors.CompositeValidationError(res...) 38 | } 39 | return nil 40 | } 41 | 42 | var setStateParamsBodyTypeStatusPropEnum []interface{} 43 | 44 | func init() { 45 | var res []string 46 | if err := json.Unmarshal([]byte(`["inactive","active"]`), &res); err != nil { 47 | panic(err) 48 | } 49 | for _, v := range res { 50 | setStateParamsBodyTypeStatusPropEnum = append(setStateParamsBodyTypeStatusPropEnum, v) 51 | } 52 | } 53 | 54 | const ( 55 | 56 | // SetStateParamsBodyStatusInactive captures enum value "inactive" 57 | SetStateParamsBodyStatusInactive string = "inactive" 58 | 59 | // SetStateParamsBodyStatusActive captures enum value "active" 60 | SetStateParamsBodyStatusActive string = "active" 61 | ) 62 | 63 | // prop value enum 64 | func (m *SetStateParamsBody) validateStatusEnum(path, location string, value string) error { 65 | if err := validate.Enum(path, location, value, setStateParamsBodyTypeStatusPropEnum); err != nil { 66 | return err 67 | } 68 | return nil 69 | } 70 | 71 | func (m *SetStateParamsBody) validateStatus(formats strfmt.Registry) error { 72 | 73 | if err := validate.Required("status", "body", m.Status); err != nil { 74 | return err 75 | } 76 | 77 | // value enum 78 | if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { 79 | return err 80 | } 81 | 82 | return nil 83 | } 84 | 85 | // MarshalBinary interface implementation 86 | func (m *SetStateParamsBody) MarshalBinary() ([]byte, error) { 87 | if m == nil { 88 | return nil, nil 89 | } 90 | return swag.WriteJSON(m) 91 | } 92 | 93 | // UnmarshalBinary interface implementation 94 | func (m *SetStateParamsBody) UnmarshalBinary(b []byte) error { 95 | var res SetStateParamsBody 96 | if err := swag.ReadJSON(b, &res); err != nil { 97 | return err 98 | } 99 | *m = res 100 | return nil 101 | } 102 | -------------------------------------------------------------------------------- /models/trigger_limits.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | // TriggerLimits Limits on a specific trigger 9 | // swagger:model TriggerLimits 10 | type TriggerLimits interface{} 11 | -------------------------------------------------------------------------------- /models/trigger_payload.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | strfmt "github.com/go-openapi/strfmt" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/swag" 13 | "github.com/go-openapi/validate" 14 | ) 15 | 16 | // TriggerPayload trigger payload 17 | // swagger:model TriggerPayload 18 | type TriggerPayload struct { 19 | 20 | // The payload of the trigger event. 21 | // Required: true 22 | Payload *string `json:"payload"` 23 | } 24 | 25 | // Validate validates this trigger payload 26 | func (m *TriggerPayload) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validatePayload(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *TriggerPayload) validatePayload(formats strfmt.Registry) error { 40 | 41 | if err := validate.Required("payload", "body", m.Payload); err != nil { 42 | return err 43 | } 44 | 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *TriggerPayload) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *TriggerPayload) UnmarshalBinary(b []byte) error { 58 | var res TriggerPayload 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /restapi/configure_kwsk_activations.go: -------------------------------------------------------------------------------- 1 | package restapi 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/go-openapi/runtime/middleware" 7 | "github.com/projectodd/kwsk/models" 8 | "github.com/projectodd/kwsk/restapi/operations" 9 | "github.com/projectodd/kwsk/restapi/operations/activations" 10 | "k8s.io/client-go/tools/cache" 11 | 12 | knative "github.com/knative/serving/pkg/client/clientset/versioned" 13 | ) 14 | 15 | func configureActivations(api *operations.KwskAPI, knativeClient *knative.Clientset, cache cache.Store) { 16 | api.ActivationsGetNamespacesNamespaceActivationsActivationidLogsHandler = activations.GetNamespacesNamespaceActivationsActivationidLogsHandlerFunc(func(params activations.GetNamespacesNamespaceActivationsActivationidLogsParams, principal *models.Principal) middleware.Responder { 17 | return middleware.NotImplemented("operation activations.GetNamespacesNamespaceActivationsActivationidLogs has not yet been implemented") 18 | }) 19 | api.ActivationsGetNamespacesNamespaceActivationsActivationidResultHandler = activations.GetNamespacesNamespaceActivationsActivationidResultHandlerFunc(func(params activations.GetNamespacesNamespaceActivationsActivationidResultParams, principal *models.Principal) middleware.Responder { 20 | return middleware.NotImplemented("operation activations.GetNamespacesNamespaceActivationsActivationidResult has not yet been implemented") 21 | }) 22 | 23 | api.ActivationsGetActivationByIDHandler = activations.GetActivationByIDHandlerFunc(getActivationByIDFunc(cache)) 24 | 25 | api.ActivationsGetActivationsHandler = activations.GetActivationsHandlerFunc(getActivationsFunc(cache)) 26 | } 27 | 28 | func getActivationByIDFunc(cache cache.Store) activations.GetActivationByIDHandlerFunc { 29 | return func(params activations.GetActivationByIDParams, principal *models.Principal) middleware.Responder { 30 | activationId := params.Activationid 31 | obj, exists, err := cache.GetByKey(activationId) 32 | if err != nil { 33 | msg := fmt.Sprintf("Error retrieving activation record: %s\n", err) 34 | errorMessage := &models.ErrorMessage{ 35 | Error: &msg, 36 | } 37 | return activations.NewGetActivationByIDInternalServerError().WithPayload(errorMessage) 38 | } 39 | if !exists { 40 | return activations.NewGetActivationByIDNotFound() 41 | } 42 | if activation, ok := obj.(models.Activation); ok { 43 | fmt.Printf("Got Activation: %+v\n", activation) 44 | return activations.NewGetActivationByIDOK().WithPayload(&activation) 45 | } 46 | return activations.NewGetActivationByIDInternalServerError() 47 | } 48 | } 49 | 50 | func getActivationsFunc(cache cache.Store) activations.GetActivationsHandlerFunc { 51 | return func(params activations.GetActivationsParams, principal *models.Principal) middleware.Responder { 52 | objs := cache.List() 53 | var payload = make([]*models.Activation, len(objs)) 54 | for i, obj := range objs { 55 | if activation, ok := obj.(models.Activation); ok { 56 | payload[i] = &activation 57 | } 58 | } 59 | return activations.NewGetActivationsOK().WithPayload(payload) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /restapi/configure_kwsk_namespaces.go: -------------------------------------------------------------------------------- 1 | package restapi 2 | 3 | import ( 4 | middleware "github.com/go-openapi/runtime/middleware" 5 | 6 | "github.com/projectodd/kwsk/models" 7 | "github.com/projectodd/kwsk/restapi/operations" 8 | "github.com/projectodd/kwsk/restapi/operations/namespaces" 9 | 10 | knative "github.com/knative/serving/pkg/client/clientset/versioned" 11 | ) 12 | 13 | func configureNamespaces(api *operations.KwskAPI, knativeClient *knative.Clientset) { 14 | api.NamespacesGetAllNamespacesHandler = namespaces.GetAllNamespacesHandlerFunc(func(params namespaces.GetAllNamespacesParams, principal *models.Principal) middleware.Responder { 15 | return middleware.NotImplemented("operation namespaces.GetAllNamespaces has not yet been implemented") 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /restapi/configure_kwsk_packages.go: -------------------------------------------------------------------------------- 1 | package restapi 2 | 3 | import ( 4 | middleware "github.com/go-openapi/runtime/middleware" 5 | 6 | "github.com/projectodd/kwsk/models" 7 | "github.com/projectodd/kwsk/restapi/operations" 8 | "github.com/projectodd/kwsk/restapi/operations/packages" 9 | 10 | knative "github.com/knative/serving/pkg/client/clientset/versioned" 11 | ) 12 | 13 | func configurePackages(api *operations.KwskAPI, knativeClient *knative.Clientset) { 14 | api.PackagesDeletePackageHandler = packages.DeletePackageHandlerFunc(func(params packages.DeletePackageParams, principal *models.Principal) middleware.Responder { 15 | return middleware.NotImplemented("operation packages.DeletePackage has not yet been implemented") 16 | }) 17 | api.PackagesGetAllPackagesHandler = packages.GetAllPackagesHandlerFunc(func(params packages.GetAllPackagesParams, principal *models.Principal) middleware.Responder { 18 | return packages.NewGetAllPackagesOK() 19 | }) 20 | api.PackagesGetPackageByNameHandler = packages.GetPackageByNameHandlerFunc(func(params packages.GetPackageByNameParams, principal *models.Principal) middleware.Responder { 21 | return middleware.NotImplemented("operation packages.GetPackageByName has not yet been implemented") 22 | }) 23 | api.PackagesUpdatePackageHandler = packages.UpdatePackageHandlerFunc(func(params packages.UpdatePackageParams, principal *models.Principal) middleware.Responder { 24 | return middleware.NotImplemented("operation packages.UpdatePackage has not yet been implemented") 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /restapi/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | /* 4 | Package restapi OpenWhisk REST API 5 | API for OpenWhisk 6 | 7 | 8 | Schemes: 9 | http 10 | Host: localhost 11 | BasePath: /api/v1 12 | Version: 0.1.0 13 | 14 | Consumes: 15 | - application/json 16 | 17 | Produces: 18 | - application/json 19 | 20 | swagger:meta 21 | */ 22 | package restapi 23 | -------------------------------------------------------------------------------- /restapi/operations/actions/delete_action.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // DeleteActionHandlerFunc turns a function with the right signature into a delete action handler 17 | type DeleteActionHandlerFunc func(DeleteActionParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn DeleteActionHandlerFunc) Handle(params DeleteActionParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // DeleteActionHandler interface for that can handle valid delete action params 25 | type DeleteActionHandler interface { 26 | Handle(DeleteActionParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewDeleteAction creates a new http.Handler for the delete action operation 30 | func NewDeleteAction(ctx *middleware.Context, handler DeleteActionHandler) *DeleteAction { 31 | return &DeleteAction{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*DeleteAction swagger:route DELETE /namespaces/{namespace}/actions/{actionName} Actions deleteAction 35 | 36 | Delete an action 37 | 38 | Delete an action 39 | 40 | */ 41 | type DeleteAction struct { 42 | Context *middleware.Context 43 | Handler DeleteActionHandler 44 | } 45 | 46 | func (o *DeleteAction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewDeleteActionParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/delete_action_in_package.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // DeleteActionInPackageHandlerFunc turns a function with the right signature into a delete action in package handler 17 | type DeleteActionInPackageHandlerFunc func(DeleteActionInPackageParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn DeleteActionInPackageHandlerFunc) Handle(params DeleteActionInPackageParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // DeleteActionInPackageHandler interface for that can handle valid delete action in package params 25 | type DeleteActionInPackageHandler interface { 26 | Handle(DeleteActionInPackageParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewDeleteActionInPackage creates a new http.Handler for the delete action in package operation 30 | func NewDeleteActionInPackage(ctx *middleware.Context, handler DeleteActionInPackageHandler) *DeleteActionInPackage { 31 | return &DeleteActionInPackage{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*DeleteActionInPackage swagger:route DELETE /namespaces/{namespace}/actions/{packageName}/{actionName} Actions deleteActionInPackage 35 | 36 | Delete an action 37 | 38 | Delete an action 39 | 40 | */ 41 | type DeleteActionInPackage struct { 42 | Context *middleware.Context 43 | Handler DeleteActionInPackageHandler 44 | } 45 | 46 | func (o *DeleteActionInPackage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewDeleteActionInPackageParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/delete_action_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewDeleteActionParams creates a new DeleteActionParams object 18 | // no default values defined in spec. 19 | func NewDeleteActionParams() DeleteActionParams { 20 | 21 | return DeleteActionParams{} 22 | } 23 | 24 | // DeleteActionParams contains all the bound params for the delete action operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters deleteAction 28 | type DeleteActionParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*Name of action to fetch 34 | Required: true 35 | In: path 36 | */ 37 | ActionName string 38 | /*The entity namespace 39 | Required: true 40 | In: path 41 | */ 42 | Namespace string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewDeleteActionParams() beforehand. 49 | func (o *DeleteActionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rActionName, rhkActionName, _ := route.Params.GetOK("actionName") 55 | if err := o.bindActionName(rActionName, rhkActionName, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 60 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *DeleteActionParams) bindActionName(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.ActionName = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *DeleteActionParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.Namespace = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/actions/delete_action_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // DeleteActionURL generates an URL for the delete action operation 16 | type DeleteActionURL struct { 17 | ActionName string 18 | Namespace string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *DeleteActionURL) WithBasePath(bp string) *DeleteActionURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *DeleteActionURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *DeleteActionURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/actions/{actionName}" 45 | 46 | actionName := o.ActionName 47 | if actionName != "" { 48 | _path = strings.Replace(_path, "{actionName}", actionName, -1) 49 | } else { 50 | return nil, errors.New("ActionName is required on DeleteActionURL") 51 | } 52 | 53 | namespace := o.Namespace 54 | if namespace != "" { 55 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 56 | } else { 57 | return nil, errors.New("Namespace is required on DeleteActionURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *DeleteActionURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *DeleteActionURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *DeleteActionURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on DeleteActionURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on DeleteActionURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *DeleteActionURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/actions/delete_web_namespace_package_name_action_name_extension_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/runtime" 12 | ) 13 | 14 | /*DeleteWebNamespacePackageNameActionNameExtensionDefault any response 15 | 16 | swagger:response deleteWebNamespacePackageNameActionNameExtensionDefault 17 | */ 18 | type DeleteWebNamespacePackageNameActionNameExtensionDefault struct { 19 | _statusCode int 20 | 21 | /* 22 | In: Body 23 | */ 24 | Payload DeleteWebNamespacePackageNameActionNameExtensionDefaultBody `json:"body,omitempty"` 25 | } 26 | 27 | // NewDeleteWebNamespacePackageNameActionNameExtensionDefault creates DeleteWebNamespacePackageNameActionNameExtensionDefault with default headers values 28 | func NewDeleteWebNamespacePackageNameActionNameExtensionDefault(code int) *DeleteWebNamespacePackageNameActionNameExtensionDefault { 29 | if code <= 0 { 30 | code = 500 31 | } 32 | 33 | return &DeleteWebNamespacePackageNameActionNameExtensionDefault{ 34 | _statusCode: code, 35 | } 36 | } 37 | 38 | // WithStatusCode adds the status to the delete web namespace package name action name extension default response 39 | func (o *DeleteWebNamespacePackageNameActionNameExtensionDefault) WithStatusCode(code int) *DeleteWebNamespacePackageNameActionNameExtensionDefault { 40 | o._statusCode = code 41 | return o 42 | } 43 | 44 | // SetStatusCode sets the status to the delete web namespace package name action name extension default response 45 | func (o *DeleteWebNamespacePackageNameActionNameExtensionDefault) SetStatusCode(code int) { 46 | o._statusCode = code 47 | } 48 | 49 | // WithPayload adds the payload to the delete web namespace package name action name extension default response 50 | func (o *DeleteWebNamespacePackageNameActionNameExtensionDefault) WithPayload(payload DeleteWebNamespacePackageNameActionNameExtensionDefaultBody) *DeleteWebNamespacePackageNameActionNameExtensionDefault { 51 | o.Payload = payload 52 | return o 53 | } 54 | 55 | // SetPayload sets the payload to the delete web namespace package name action name extension default response 56 | func (o *DeleteWebNamespacePackageNameActionNameExtensionDefault) SetPayload(payload DeleteWebNamespacePackageNameActionNameExtensionDefaultBody) { 57 | o.Payload = payload 58 | } 59 | 60 | // WriteResponse to the client 61 | func (o *DeleteWebNamespacePackageNameActionNameExtensionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 62 | 63 | rw.WriteHeader(o._statusCode) 64 | payload := o.Payload 65 | if err := producer.Produce(rw, payload); err != nil { 66 | panic(err) // let the recovery middleware deal with this 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /restapi/operations/actions/get_action_by_name.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetActionByNameHandlerFunc turns a function with the right signature into a get action by name handler 17 | type GetActionByNameHandlerFunc func(GetActionByNameParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetActionByNameHandlerFunc) Handle(params GetActionByNameParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetActionByNameHandler interface for that can handle valid get action by name params 25 | type GetActionByNameHandler interface { 26 | Handle(GetActionByNameParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetActionByName creates a new http.Handler for the get action by name operation 30 | func NewGetActionByName(ctx *middleware.Context, handler GetActionByNameHandler) *GetActionByName { 31 | return &GetActionByName{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetActionByName swagger:route GET /namespaces/{namespace}/actions/{actionName} Actions getActionByName 35 | 36 | Get action information 37 | 38 | Get action information. 39 | 40 | */ 41 | type GetActionByName struct { 42 | Context *middleware.Context 43 | Handler GetActionByNameHandler 44 | } 45 | 46 | func (o *GetActionByName) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetActionByNameParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/get_action_in_package_by_name.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetActionInPackageByNameHandlerFunc turns a function with the right signature into a get action in package by name handler 17 | type GetActionInPackageByNameHandlerFunc func(GetActionInPackageByNameParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetActionInPackageByNameHandlerFunc) Handle(params GetActionInPackageByNameParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetActionInPackageByNameHandler interface for that can handle valid get action in package by name params 25 | type GetActionInPackageByNameHandler interface { 26 | Handle(GetActionInPackageByNameParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetActionInPackageByName creates a new http.Handler for the get action in package by name operation 30 | func NewGetActionInPackageByName(ctx *middleware.Context, handler GetActionInPackageByNameHandler) *GetActionInPackageByName { 31 | return &GetActionInPackageByName{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetActionInPackageByName swagger:route GET /namespaces/{namespace}/actions/{packageName}/{actionName} Actions getActionInPackageByName 35 | 36 | Get action information 37 | 38 | Get action information. 39 | 40 | */ 41 | type GetActionInPackageByName struct { 42 | Context *middleware.Context 43 | Handler GetActionInPackageByNameHandler 44 | } 45 | 46 | func (o *GetActionInPackageByName) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetActionInPackageByNameParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/get_all_actions.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetAllActionsHandlerFunc turns a function with the right signature into a get all actions handler 17 | type GetAllActionsHandlerFunc func(GetAllActionsParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetAllActionsHandlerFunc) Handle(params GetAllActionsParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetAllActionsHandler interface for that can handle valid get all actions params 25 | type GetAllActionsHandler interface { 26 | Handle(GetAllActionsParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetAllActions creates a new http.Handler for the get all actions operation 30 | func NewGetAllActions(ctx *middleware.Context, handler GetAllActionsHandler) *GetAllActions { 31 | return &GetAllActions{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetAllActions swagger:route GET /namespaces/{namespace}/actions Actions getAllActions 35 | 36 | Get all actions 37 | 38 | Get all actions 39 | 40 | */ 41 | type GetAllActions struct { 42 | Context *middleware.Context 43 | Handler GetAllActionsHandler 44 | } 45 | 46 | func (o *GetAllActions) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetAllActionsParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/get_web_namespace_package_name_action_name_extension_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/runtime" 12 | ) 13 | 14 | /*GetWebNamespacePackageNameActionNameExtensionDefault any response 15 | 16 | swagger:response getWebNamespacePackageNameActionNameExtensionDefault 17 | */ 18 | type GetWebNamespacePackageNameActionNameExtensionDefault struct { 19 | _statusCode int 20 | 21 | /* 22 | In: Body 23 | */ 24 | Payload GetWebNamespacePackageNameActionNameExtensionDefaultBody `json:"body,omitempty"` 25 | } 26 | 27 | // NewGetWebNamespacePackageNameActionNameExtensionDefault creates GetWebNamespacePackageNameActionNameExtensionDefault with default headers values 28 | func NewGetWebNamespacePackageNameActionNameExtensionDefault(code int) *GetWebNamespacePackageNameActionNameExtensionDefault { 29 | if code <= 0 { 30 | code = 500 31 | } 32 | 33 | return &GetWebNamespacePackageNameActionNameExtensionDefault{ 34 | _statusCode: code, 35 | } 36 | } 37 | 38 | // WithStatusCode adds the status to the get web namespace package name action name extension default response 39 | func (o *GetWebNamespacePackageNameActionNameExtensionDefault) WithStatusCode(code int) *GetWebNamespacePackageNameActionNameExtensionDefault { 40 | o._statusCode = code 41 | return o 42 | } 43 | 44 | // SetStatusCode sets the status to the get web namespace package name action name extension default response 45 | func (o *GetWebNamespacePackageNameActionNameExtensionDefault) SetStatusCode(code int) { 46 | o._statusCode = code 47 | } 48 | 49 | // WithPayload adds the payload to the get web namespace package name action name extension default response 50 | func (o *GetWebNamespacePackageNameActionNameExtensionDefault) WithPayload(payload GetWebNamespacePackageNameActionNameExtensionDefaultBody) *GetWebNamespacePackageNameActionNameExtensionDefault { 51 | o.Payload = payload 52 | return o 53 | } 54 | 55 | // SetPayload sets the payload to the get web namespace package name action name extension default response 56 | func (o *GetWebNamespacePackageNameActionNameExtensionDefault) SetPayload(payload GetWebNamespacePackageNameActionNameExtensionDefaultBody) { 57 | o.Payload = payload 58 | } 59 | 60 | // WriteResponse to the client 61 | func (o *GetWebNamespacePackageNameActionNameExtensionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 62 | 63 | rw.WriteHeader(o._statusCode) 64 | payload := o.Payload 65 | if err := producer.Produce(rw, payload); err != nil { 66 | panic(err) // let the recovery middleware deal with this 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /restapi/operations/actions/invoke_action.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // InvokeActionHandlerFunc turns a function with the right signature into a invoke action handler 17 | type InvokeActionHandlerFunc func(InvokeActionParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn InvokeActionHandlerFunc) Handle(params InvokeActionParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // InvokeActionHandler interface for that can handle valid invoke action params 25 | type InvokeActionHandler interface { 26 | Handle(InvokeActionParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewInvokeAction creates a new http.Handler for the invoke action operation 30 | func NewInvokeAction(ctx *middleware.Context, handler InvokeActionHandler) *InvokeAction { 31 | return &InvokeAction{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*InvokeAction swagger:route POST /namespaces/{namespace}/actions/{actionName} Actions invokeAction 35 | 36 | Invoke an action 37 | 38 | Invoke an action 39 | 40 | */ 41 | type InvokeAction struct { 42 | Context *middleware.Context 43 | Handler InvokeActionHandler 44 | } 45 | 46 | func (o *InvokeAction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewInvokeActionParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | 77 | // InvokeActionOKBody invoke action o k body 78 | // swagger:model InvokeActionOKBody 79 | type InvokeActionOKBody interface{} 80 | -------------------------------------------------------------------------------- /restapi/operations/actions/invoke_action_in_package.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // InvokeActionInPackageHandlerFunc turns a function with the right signature into a invoke action in package handler 17 | type InvokeActionInPackageHandlerFunc func(InvokeActionInPackageParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn InvokeActionInPackageHandlerFunc) Handle(params InvokeActionInPackageParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // InvokeActionInPackageHandler interface for that can handle valid invoke action in package params 25 | type InvokeActionInPackageHandler interface { 26 | Handle(InvokeActionInPackageParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewInvokeActionInPackage creates a new http.Handler for the invoke action in package operation 30 | func NewInvokeActionInPackage(ctx *middleware.Context, handler InvokeActionInPackageHandler) *InvokeActionInPackage { 31 | return &InvokeActionInPackage{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*InvokeActionInPackage swagger:route POST /namespaces/{namespace}/actions/{packageName}/{actionName} Actions invokeActionInPackage 35 | 36 | Invoke an action 37 | 38 | Invoke an action 39 | 40 | */ 41 | type InvokeActionInPackage struct { 42 | Context *middleware.Context 43 | Handler InvokeActionInPackageHandler 44 | } 45 | 46 | func (o *InvokeActionInPackage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewInvokeActionInPackageParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/post_web_namespace_package_name_action_name_extension_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/runtime" 12 | ) 13 | 14 | /*PostWebNamespacePackageNameActionNameExtensionDefault any response 15 | 16 | swagger:response postWebNamespacePackageNameActionNameExtensionDefault 17 | */ 18 | type PostWebNamespacePackageNameActionNameExtensionDefault struct { 19 | _statusCode int 20 | 21 | /* 22 | In: Body 23 | */ 24 | Payload PostWebNamespacePackageNameActionNameExtensionDefaultBody `json:"body,omitempty"` 25 | } 26 | 27 | // NewPostWebNamespacePackageNameActionNameExtensionDefault creates PostWebNamespacePackageNameActionNameExtensionDefault with default headers values 28 | func NewPostWebNamespacePackageNameActionNameExtensionDefault(code int) *PostWebNamespacePackageNameActionNameExtensionDefault { 29 | if code <= 0 { 30 | code = 500 31 | } 32 | 33 | return &PostWebNamespacePackageNameActionNameExtensionDefault{ 34 | _statusCode: code, 35 | } 36 | } 37 | 38 | // WithStatusCode adds the status to the post web namespace package name action name extension default response 39 | func (o *PostWebNamespacePackageNameActionNameExtensionDefault) WithStatusCode(code int) *PostWebNamespacePackageNameActionNameExtensionDefault { 40 | o._statusCode = code 41 | return o 42 | } 43 | 44 | // SetStatusCode sets the status to the post web namespace package name action name extension default response 45 | func (o *PostWebNamespacePackageNameActionNameExtensionDefault) SetStatusCode(code int) { 46 | o._statusCode = code 47 | } 48 | 49 | // WithPayload adds the payload to the post web namespace package name action name extension default response 50 | func (o *PostWebNamespacePackageNameActionNameExtensionDefault) WithPayload(payload PostWebNamespacePackageNameActionNameExtensionDefaultBody) *PostWebNamespacePackageNameActionNameExtensionDefault { 51 | o.Payload = payload 52 | return o 53 | } 54 | 55 | // SetPayload sets the payload to the post web namespace package name action name extension default response 56 | func (o *PostWebNamespacePackageNameActionNameExtensionDefault) SetPayload(payload PostWebNamespacePackageNameActionNameExtensionDefaultBody) { 57 | o.Payload = payload 58 | } 59 | 60 | // WriteResponse to the client 61 | func (o *PostWebNamespacePackageNameActionNameExtensionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 62 | 63 | rw.WriteHeader(o._statusCode) 64 | payload := o.Payload 65 | if err := producer.Produce(rw, payload); err != nil { 66 | panic(err) // let the recovery middleware deal with this 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /restapi/operations/actions/put_web_namespace_package_name_action_name_extension_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/runtime" 12 | ) 13 | 14 | /*PutWebNamespacePackageNameActionNameExtensionDefault any response 15 | 16 | swagger:response putWebNamespacePackageNameActionNameExtensionDefault 17 | */ 18 | type PutWebNamespacePackageNameActionNameExtensionDefault struct { 19 | _statusCode int 20 | 21 | /* 22 | In: Body 23 | */ 24 | Payload PutWebNamespacePackageNameActionNameExtensionDefaultBody `json:"body,omitempty"` 25 | } 26 | 27 | // NewPutWebNamespacePackageNameActionNameExtensionDefault creates PutWebNamespacePackageNameActionNameExtensionDefault with default headers values 28 | func NewPutWebNamespacePackageNameActionNameExtensionDefault(code int) *PutWebNamespacePackageNameActionNameExtensionDefault { 29 | if code <= 0 { 30 | code = 500 31 | } 32 | 33 | return &PutWebNamespacePackageNameActionNameExtensionDefault{ 34 | _statusCode: code, 35 | } 36 | } 37 | 38 | // WithStatusCode adds the status to the put web namespace package name action name extension default response 39 | func (o *PutWebNamespacePackageNameActionNameExtensionDefault) WithStatusCode(code int) *PutWebNamespacePackageNameActionNameExtensionDefault { 40 | o._statusCode = code 41 | return o 42 | } 43 | 44 | // SetStatusCode sets the status to the put web namespace package name action name extension default response 45 | func (o *PutWebNamespacePackageNameActionNameExtensionDefault) SetStatusCode(code int) { 46 | o._statusCode = code 47 | } 48 | 49 | // WithPayload adds the payload to the put web namespace package name action name extension default response 50 | func (o *PutWebNamespacePackageNameActionNameExtensionDefault) WithPayload(payload PutWebNamespacePackageNameActionNameExtensionDefaultBody) *PutWebNamespacePackageNameActionNameExtensionDefault { 51 | o.Payload = payload 52 | return o 53 | } 54 | 55 | // SetPayload sets the payload to the put web namespace package name action name extension default response 56 | func (o *PutWebNamespacePackageNameActionNameExtensionDefault) SetPayload(payload PutWebNamespacePackageNameActionNameExtensionDefaultBody) { 57 | o.Payload = payload 58 | } 59 | 60 | // WriteResponse to the client 61 | func (o *PutWebNamespacePackageNameActionNameExtensionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 62 | 63 | rw.WriteHeader(o._statusCode) 64 | payload := o.Payload 65 | if err := producer.Produce(rw, payload); err != nil { 66 | panic(err) // let the recovery middleware deal with this 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /restapi/operations/actions/update_action.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // UpdateActionHandlerFunc turns a function with the right signature into a update action handler 17 | type UpdateActionHandlerFunc func(UpdateActionParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn UpdateActionHandlerFunc) Handle(params UpdateActionParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // UpdateActionHandler interface for that can handle valid update action params 25 | type UpdateActionHandler interface { 26 | Handle(UpdateActionParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewUpdateAction creates a new http.Handler for the update action operation 30 | func NewUpdateAction(ctx *middleware.Context, handler UpdateActionHandler) *UpdateAction { 31 | return &UpdateAction{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*UpdateAction swagger:route PUT /namespaces/{namespace}/actions/{actionName} Actions updateAction 35 | 36 | Create or update an action 37 | 38 | Create or update an action 39 | 40 | */ 41 | type UpdateAction struct { 42 | Context *middleware.Context 43 | Handler UpdateActionHandler 44 | } 45 | 46 | func (o *UpdateAction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewUpdateActionParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/actions/update_action_in_package.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package actions 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // UpdateActionInPackageHandlerFunc turns a function with the right signature into a update action in package handler 17 | type UpdateActionInPackageHandlerFunc func(UpdateActionInPackageParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn UpdateActionInPackageHandlerFunc) Handle(params UpdateActionInPackageParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // UpdateActionInPackageHandler interface for that can handle valid update action in package params 25 | type UpdateActionInPackageHandler interface { 26 | Handle(UpdateActionInPackageParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewUpdateActionInPackage creates a new http.Handler for the update action in package operation 30 | func NewUpdateActionInPackage(ctx *middleware.Context, handler UpdateActionInPackageHandler) *UpdateActionInPackage { 31 | return &UpdateActionInPackage{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*UpdateActionInPackage swagger:route PUT /namespaces/{namespace}/actions/{packageName}/{actionName} Actions updateActionInPackage 35 | 36 | Create or update an action 37 | 38 | Create or update an action 39 | 40 | */ 41 | type UpdateActionInPackage struct { 42 | Context *middleware.Context 43 | Handler UpdateActionInPackageHandler 44 | } 45 | 46 | func (o *UpdateActionInPackage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewUpdateActionInPackageParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_activation_by_id.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetActivationByIDHandlerFunc turns a function with the right signature into a get activation by Id handler 17 | type GetActivationByIDHandlerFunc func(GetActivationByIDParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetActivationByIDHandlerFunc) Handle(params GetActivationByIDParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetActivationByIDHandler interface for that can handle valid get activation by Id params 25 | type GetActivationByIDHandler interface { 26 | Handle(GetActivationByIDParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetActivationByID creates a new http.Handler for the get activation by Id operation 30 | func NewGetActivationByID(ctx *middleware.Context, handler GetActivationByIDHandler) *GetActivationByID { 31 | return &GetActivationByID{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetActivationByID swagger:route GET /namespaces/{namespace}/activations/{activationid} Activations getActivationById 35 | 36 | Get activation information 37 | 38 | Get activation information. 39 | 40 | */ 41 | type GetActivationByID struct { 42 | Context *middleware.Context 43 | Handler GetActivationByIDHandler 44 | } 45 | 46 | func (o *GetActivationByID) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetActivationByIDParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_activation_by_id_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewGetActivationByIDParams creates a new GetActivationByIDParams object 18 | // no default values defined in spec. 19 | func NewGetActivationByIDParams() GetActivationByIDParams { 20 | 21 | return GetActivationByIDParams{} 22 | } 23 | 24 | // GetActivationByIDParams contains all the bound params for the get activation by Id operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters getActivationById 28 | type GetActivationByIDParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*Name of activation to fetch 34 | Required: true 35 | In: path 36 | */ 37 | Activationid string 38 | /*The entity namespace 39 | Required: true 40 | In: path 41 | */ 42 | Namespace string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewGetActivationByIDParams() beforehand. 49 | func (o *GetActivationByIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rActivationid, rhkActivationid, _ := route.Params.GetOK("activationid") 55 | if err := o.bindActivationid(rActivationid, rhkActivationid, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 60 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *GetActivationByIDParams) bindActivationid(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Activationid = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *GetActivationByIDParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.Namespace = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_activation_by_id_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // GetActivationByIDURL generates an URL for the get activation by Id operation 16 | type GetActivationByIDURL struct { 17 | Activationid string 18 | Namespace string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *GetActivationByIDURL) WithBasePath(bp string) *GetActivationByIDURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *GetActivationByIDURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *GetActivationByIDURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/activations/{activationid}" 45 | 46 | activationid := o.Activationid 47 | if activationid != "" { 48 | _path = strings.Replace(_path, "{activationid}", activationid, -1) 49 | } else { 50 | return nil, errors.New("Activationid is required on GetActivationByIDURL") 51 | } 52 | 53 | namespace := o.Namespace 54 | if namespace != "" { 55 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 56 | } else { 57 | return nil, errors.New("Namespace is required on GetActivationByIDURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *GetActivationByIDURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *GetActivationByIDURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *GetActivationByIDURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on GetActivationByIDURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on GetActivationByIDURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *GetActivationByIDURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_activations.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetActivationsHandlerFunc turns a function with the right signature into a get activations handler 17 | type GetActivationsHandlerFunc func(GetActivationsParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetActivationsHandlerFunc) Handle(params GetActivationsParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetActivationsHandler interface for that can handle valid get activations params 25 | type GetActivationsHandler interface { 26 | Handle(GetActivationsParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetActivations creates a new http.Handler for the get activations operation 30 | func NewGetActivations(ctx *middleware.Context, handler GetActivationsHandler) *GetActivations { 31 | return &GetActivations{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetActivations swagger:route GET /namespaces/{namespace}/activations Activations getActivations 35 | 36 | Get activation ids 37 | 38 | Get activation ids. 39 | 40 | */ 41 | type GetActivations struct { 42 | Context *middleware.Context 43 | Handler GetActivationsHandler 44 | } 45 | 46 | func (o *GetActivations) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetActivationsParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_namespaces_namespace_activations_activationid_logs.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetNamespacesNamespaceActivationsActivationidLogsHandlerFunc turns a function with the right signature into a get namespaces namespace activations activationid logs handler 17 | type GetNamespacesNamespaceActivationsActivationidLogsHandlerFunc func(GetNamespacesNamespaceActivationsActivationidLogsParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetNamespacesNamespaceActivationsActivationidLogsHandlerFunc) Handle(params GetNamespacesNamespaceActivationsActivationidLogsParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetNamespacesNamespaceActivationsActivationidLogsHandler interface for that can handle valid get namespaces namespace activations activationid logs params 25 | type GetNamespacesNamespaceActivationsActivationidLogsHandler interface { 26 | Handle(GetNamespacesNamespaceActivationsActivationidLogsParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetNamespacesNamespaceActivationsActivationidLogs creates a new http.Handler for the get namespaces namespace activations activationid logs operation 30 | func NewGetNamespacesNamespaceActivationsActivationidLogs(ctx *middleware.Context, handler GetNamespacesNamespaceActivationsActivationidLogsHandler) *GetNamespacesNamespaceActivationsActivationidLogs { 31 | return &GetNamespacesNamespaceActivationsActivationidLogs{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetNamespacesNamespaceActivationsActivationidLogs swagger:route GET /namespaces/{namespace}/activations/{activationid}/logs Activations getNamespacesNamespaceActivationsActivationidLogs 35 | 36 | Get the logs for an activation 37 | 38 | Get activation logs information. 39 | 40 | */ 41 | type GetNamespacesNamespaceActivationsActivationidLogs struct { 42 | Context *middleware.Context 43 | Handler GetNamespacesNamespaceActivationsActivationidLogsHandler 44 | } 45 | 46 | func (o *GetNamespacesNamespaceActivationsActivationidLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetNamespacesNamespaceActivationsActivationidLogsParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_namespaces_namespace_activations_activationid_logs_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewGetNamespacesNamespaceActivationsActivationidLogsParams creates a new GetNamespacesNamespaceActivationsActivationidLogsParams object 18 | // no default values defined in spec. 19 | func NewGetNamespacesNamespaceActivationsActivationidLogsParams() GetNamespacesNamespaceActivationsActivationidLogsParams { 20 | 21 | return GetNamespacesNamespaceActivationsActivationidLogsParams{} 22 | } 23 | 24 | // GetNamespacesNamespaceActivationsActivationidLogsParams contains all the bound params for the get namespaces namespace activations activationid logs operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters GetNamespacesNamespaceActivationsActivationidLogs 28 | type GetNamespacesNamespaceActivationsActivationidLogsParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*Name of activation to fetch 34 | Required: true 35 | In: path 36 | */ 37 | Activationid string 38 | /*The entity namespace 39 | Required: true 40 | In: path 41 | */ 42 | Namespace string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewGetNamespacesNamespaceActivationsActivationidLogsParams() beforehand. 49 | func (o *GetNamespacesNamespaceActivationsActivationidLogsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rActivationid, rhkActivationid, _ := route.Params.GetOK("activationid") 55 | if err := o.bindActivationid(rActivationid, rhkActivationid, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 60 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *GetNamespacesNamespaceActivationsActivationidLogsParams) bindActivationid(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Activationid = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *GetNamespacesNamespaceActivationsActivationidLogsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.Namespace = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_namespaces_namespace_activations_activationid_result.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetNamespacesNamespaceActivationsActivationidResultHandlerFunc turns a function with the right signature into a get namespaces namespace activations activationid result handler 17 | type GetNamespacesNamespaceActivationsActivationidResultHandlerFunc func(GetNamespacesNamespaceActivationsActivationidResultParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetNamespacesNamespaceActivationsActivationidResultHandlerFunc) Handle(params GetNamespacesNamespaceActivationsActivationidResultParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetNamespacesNamespaceActivationsActivationidResultHandler interface for that can handle valid get namespaces namespace activations activationid result params 25 | type GetNamespacesNamespaceActivationsActivationidResultHandler interface { 26 | Handle(GetNamespacesNamespaceActivationsActivationidResultParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetNamespacesNamespaceActivationsActivationidResult creates a new http.Handler for the get namespaces namespace activations activationid result operation 30 | func NewGetNamespacesNamespaceActivationsActivationidResult(ctx *middleware.Context, handler GetNamespacesNamespaceActivationsActivationidResultHandler) *GetNamespacesNamespaceActivationsActivationidResult { 31 | return &GetNamespacesNamespaceActivationsActivationidResult{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetNamespacesNamespaceActivationsActivationidResult swagger:route GET /namespaces/{namespace}/activations/{activationid}/result Activations getNamespacesNamespaceActivationsActivationidResult 35 | 36 | Get the result of an activation 37 | 38 | Get activation result. 39 | 40 | */ 41 | type GetNamespacesNamespaceActivationsActivationidResult struct { 42 | Context *middleware.Context 43 | Handler GetNamespacesNamespaceActivationsActivationidResultHandler 44 | } 45 | 46 | func (o *GetNamespacesNamespaceActivationsActivationidResult) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetNamespacesNamespaceActivationsActivationidResultParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/activations/get_namespaces_namespace_activations_activationid_result_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package activations 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewGetNamespacesNamespaceActivationsActivationidResultParams creates a new GetNamespacesNamespaceActivationsActivationidResultParams object 18 | // no default values defined in spec. 19 | func NewGetNamespacesNamespaceActivationsActivationidResultParams() GetNamespacesNamespaceActivationsActivationidResultParams { 20 | 21 | return GetNamespacesNamespaceActivationsActivationidResultParams{} 22 | } 23 | 24 | // GetNamespacesNamespaceActivationsActivationidResultParams contains all the bound params for the get namespaces namespace activations activationid result operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters GetNamespacesNamespaceActivationsActivationidResult 28 | type GetNamespacesNamespaceActivationsActivationidResultParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*Name of activation to fetch 34 | Required: true 35 | In: path 36 | */ 37 | Activationid string 38 | /*The entity namespace 39 | Required: true 40 | In: path 41 | */ 42 | Namespace string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewGetNamespacesNamespaceActivationsActivationidResultParams() beforehand. 49 | func (o *GetNamespacesNamespaceActivationsActivationidResultParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rActivationid, rhkActivationid, _ := route.Params.GetOK("activationid") 55 | if err := o.bindActivationid(rActivationid, rhkActivationid, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 60 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *GetNamespacesNamespaceActivationsActivationidResultParams) bindActivationid(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Activationid = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *GetNamespacesNamespaceActivationsActivationidResultParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.Namespace = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/namespaces/get_all_namespaces.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package namespaces 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetAllNamespacesHandlerFunc turns a function with the right signature into a get all namespaces handler 17 | type GetAllNamespacesHandlerFunc func(GetAllNamespacesParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetAllNamespacesHandlerFunc) Handle(params GetAllNamespacesParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetAllNamespacesHandler interface for that can handle valid get all namespaces params 25 | type GetAllNamespacesHandler interface { 26 | Handle(GetAllNamespacesParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetAllNamespaces creates a new http.Handler for the get all namespaces operation 30 | func NewGetAllNamespaces(ctx *middleware.Context, handler GetAllNamespacesHandler) *GetAllNamespaces { 31 | return &GetAllNamespaces{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetAllNamespaces swagger:route GET /namespaces Namespaces getAllNamespaces 35 | 36 | Get all namespaces for authenticated user 37 | 38 | Get all namespaces for authenticated user 39 | 40 | */ 41 | type GetAllNamespaces struct { 42 | Context *middleware.Context 43 | Handler GetAllNamespacesHandler 44 | } 45 | 46 | func (o *GetAllNamespaces) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetAllNamespacesParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/namespaces/get_all_namespaces_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package namespaces 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | ) 14 | 15 | // NewGetAllNamespacesParams creates a new GetAllNamespacesParams object 16 | // no default values defined in spec. 17 | func NewGetAllNamespacesParams() GetAllNamespacesParams { 18 | 19 | return GetAllNamespacesParams{} 20 | } 21 | 22 | // GetAllNamespacesParams contains all the bound params for the get all namespaces operation 23 | // typically these are obtained from a http.Request 24 | // 25 | // swagger:parameters getAllNamespaces 26 | type GetAllNamespacesParams struct { 27 | 28 | // HTTP Request Object 29 | HTTPRequest *http.Request `json:"-"` 30 | } 31 | 32 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 33 | // for simple values it will use straight method calls. 34 | // 35 | // To ensure default values, the struct must have been initialized with NewGetAllNamespacesParams() beforehand. 36 | func (o *GetAllNamespacesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 37 | var res []error 38 | 39 | o.HTTPRequest = r 40 | 41 | if len(res) > 0 { 42 | return errors.CompositeValidationError(res...) 43 | } 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /restapi/operations/namespaces/get_all_namespaces_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package namespaces 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | ) 13 | 14 | // GetAllNamespacesURL generates an URL for the get all namespaces operation 15 | type GetAllNamespacesURL struct { 16 | _basePath string 17 | } 18 | 19 | // WithBasePath sets the base path for this url builder, only required when it's different from the 20 | // base path specified in the swagger spec. 21 | // When the value of the base path is an empty string 22 | func (o *GetAllNamespacesURL) WithBasePath(bp string) *GetAllNamespacesURL { 23 | o.SetBasePath(bp) 24 | return o 25 | } 26 | 27 | // SetBasePath sets the base path for this url builder, only required when it's different from the 28 | // base path specified in the swagger spec. 29 | // When the value of the base path is an empty string 30 | func (o *GetAllNamespacesURL) SetBasePath(bp string) { 31 | o._basePath = bp 32 | } 33 | 34 | // Build a url path and query string 35 | func (o *GetAllNamespacesURL) Build() (*url.URL, error) { 36 | var result url.URL 37 | 38 | var _path = "/namespaces" 39 | 40 | _basePath := o._basePath 41 | if _basePath == "" { 42 | _basePath = "/api/v1" 43 | } 44 | result.Path = golangswaggerpaths.Join(_basePath, _path) 45 | 46 | return &result, nil 47 | } 48 | 49 | // Must is a helper function to panic when the url builder returns an error 50 | func (o *GetAllNamespacesURL) Must(u *url.URL, err error) *url.URL { 51 | if err != nil { 52 | panic(err) 53 | } 54 | if u == nil { 55 | panic("url can't be nil") 56 | } 57 | return u 58 | } 59 | 60 | // String returns the string representation of the path with query string 61 | func (o *GetAllNamespacesURL) String() string { 62 | return o.Must(o.Build()).String() 63 | } 64 | 65 | // BuildFull builds a full url with scheme, host, path and query string 66 | func (o *GetAllNamespacesURL) BuildFull(scheme, host string) (*url.URL, error) { 67 | if scheme == "" { 68 | return nil, errors.New("scheme is required for a full url on GetAllNamespacesURL") 69 | } 70 | if host == "" { 71 | return nil, errors.New("host is required for a full url on GetAllNamespacesURL") 72 | } 73 | 74 | base, err := o.Build() 75 | if err != nil { 76 | return nil, err 77 | } 78 | 79 | base.Scheme = scheme 80 | base.Host = host 81 | return base, nil 82 | } 83 | 84 | // StringFull returns the string representation of a complete url 85 | func (o *GetAllNamespacesURL) StringFull(scheme, host string) string { 86 | return o.Must(o.BuildFull(scheme, host)).String() 87 | } 88 | -------------------------------------------------------------------------------- /restapi/operations/packages/delete_package.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // DeletePackageHandlerFunc turns a function with the right signature into a delete package handler 17 | type DeletePackageHandlerFunc func(DeletePackageParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn DeletePackageHandlerFunc) Handle(params DeletePackageParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // DeletePackageHandler interface for that can handle valid delete package params 25 | type DeletePackageHandler interface { 26 | Handle(DeletePackageParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewDeletePackage creates a new http.Handler for the delete package operation 30 | func NewDeletePackage(ctx *middleware.Context, handler DeletePackageHandler) *DeletePackage { 31 | return &DeletePackage{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*DeletePackage swagger:route DELETE /namespaces/{namespace}/packages/{packageName} Packages deletePackage 35 | 36 | Delete a package 37 | 38 | Delete a package 39 | 40 | */ 41 | type DeletePackage struct { 42 | Context *middleware.Context 43 | Handler DeletePackageHandler 44 | } 45 | 46 | func (o *DeletePackage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewDeletePackageParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/packages/delete_package_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewDeletePackageParams creates a new DeletePackageParams object 18 | // no default values defined in spec. 19 | func NewDeletePackageParams() DeletePackageParams { 20 | 21 | return DeletePackageParams{} 22 | } 23 | 24 | // DeletePackageParams contains all the bound params for the delete package operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters deletePackage 28 | type DeletePackageParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*The entity namespace 34 | Required: true 35 | In: path 36 | */ 37 | Namespace string 38 | /*Name of package 39 | Required: true 40 | In: path 41 | */ 42 | PackageName string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewDeletePackageParams() beforehand. 49 | func (o *DeletePackageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 55 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rPackageName, rhkPackageName, _ := route.Params.GetOK("packageName") 60 | if err := o.bindPackageName(rPackageName, rhkPackageName, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *DeletePackageParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Namespace = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *DeletePackageParams) bindPackageName(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.PackageName = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/packages/delete_package_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // DeletePackageURL generates an URL for the delete package operation 16 | type DeletePackageURL struct { 17 | Namespace string 18 | PackageName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *DeletePackageURL) WithBasePath(bp string) *DeletePackageURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *DeletePackageURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *DeletePackageURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/packages/{packageName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on DeletePackageURL") 51 | } 52 | 53 | packageName := o.PackageName 54 | if packageName != "" { 55 | _path = strings.Replace(_path, "{packageName}", packageName, -1) 56 | } else { 57 | return nil, errors.New("PackageName is required on DeletePackageURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *DeletePackageURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *DeletePackageURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *DeletePackageURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on DeletePackageURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on DeletePackageURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *DeletePackageURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/packages/get_all_packages.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetAllPackagesHandlerFunc turns a function with the right signature into a get all packages handler 17 | type GetAllPackagesHandlerFunc func(GetAllPackagesParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetAllPackagesHandlerFunc) Handle(params GetAllPackagesParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetAllPackagesHandler interface for that can handle valid get all packages params 25 | type GetAllPackagesHandler interface { 26 | Handle(GetAllPackagesParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetAllPackages creates a new http.Handler for the get all packages operation 30 | func NewGetAllPackages(ctx *middleware.Context, handler GetAllPackagesHandler) *GetAllPackages { 31 | return &GetAllPackages{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetAllPackages swagger:route GET /namespaces/{namespace}/packages Packages getAllPackages 35 | 36 | Get all packages 37 | 38 | Get all packages 39 | 40 | */ 41 | type GetAllPackages struct { 42 | Context *middleware.Context 43 | Handler GetAllPackagesHandler 44 | } 45 | 46 | func (o *GetAllPackages) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetAllPackagesParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/packages/get_package_by_name.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetPackageByNameHandlerFunc turns a function with the right signature into a get package by name handler 17 | type GetPackageByNameHandlerFunc func(GetPackageByNameParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetPackageByNameHandlerFunc) Handle(params GetPackageByNameParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetPackageByNameHandler interface for that can handle valid get package by name params 25 | type GetPackageByNameHandler interface { 26 | Handle(GetPackageByNameParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetPackageByName creates a new http.Handler for the get package by name operation 30 | func NewGetPackageByName(ctx *middleware.Context, handler GetPackageByNameHandler) *GetPackageByName { 31 | return &GetPackageByName{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetPackageByName swagger:route GET /namespaces/{namespace}/packages/{packageName} Packages getPackageByName 35 | 36 | Get package information 37 | 38 | Get package information. 39 | 40 | */ 41 | type GetPackageByName struct { 42 | Context *middleware.Context 43 | Handler GetPackageByNameHandler 44 | } 45 | 46 | func (o *GetPackageByName) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetPackageByNameParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/packages/get_package_by_name_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewGetPackageByNameParams creates a new GetPackageByNameParams object 18 | // no default values defined in spec. 19 | func NewGetPackageByNameParams() GetPackageByNameParams { 20 | 21 | return GetPackageByNameParams{} 22 | } 23 | 24 | // GetPackageByNameParams contains all the bound params for the get package by name operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters getPackageByName 28 | type GetPackageByNameParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*The entity namespace 34 | Required: true 35 | In: path 36 | */ 37 | Namespace string 38 | /*Name of package to fetch 39 | Required: true 40 | In: path 41 | */ 42 | PackageName string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewGetPackageByNameParams() beforehand. 49 | func (o *GetPackageByNameParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 55 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rPackageName, rhkPackageName, _ := route.Params.GetOK("packageName") 60 | if err := o.bindPackageName(rPackageName, rhkPackageName, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *GetPackageByNameParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Namespace = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *GetPackageByNameParams) bindPackageName(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.PackageName = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/packages/get_package_by_name_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // GetPackageByNameURL generates an URL for the get package by name operation 16 | type GetPackageByNameURL struct { 17 | Namespace string 18 | PackageName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *GetPackageByNameURL) WithBasePath(bp string) *GetPackageByNameURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *GetPackageByNameURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *GetPackageByNameURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/packages/{packageName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on GetPackageByNameURL") 51 | } 52 | 53 | packageName := o.PackageName 54 | if packageName != "" { 55 | _path = strings.Replace(_path, "{packageName}", packageName, -1) 56 | } else { 57 | return nil, errors.New("PackageName is required on GetPackageByNameURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *GetPackageByNameURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *GetPackageByNameURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *GetPackageByNameURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on GetPackageByNameURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on GetPackageByNameURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *GetPackageByNameURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/packages/update_package.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package packages 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // UpdatePackageHandlerFunc turns a function with the right signature into a update package handler 17 | type UpdatePackageHandlerFunc func(UpdatePackageParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn UpdatePackageHandlerFunc) Handle(params UpdatePackageParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // UpdatePackageHandler interface for that can handle valid update package params 25 | type UpdatePackageHandler interface { 26 | Handle(UpdatePackageParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewUpdatePackage creates a new http.Handler for the update package operation 30 | func NewUpdatePackage(ctx *middleware.Context, handler UpdatePackageHandler) *UpdatePackage { 31 | return &UpdatePackage{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*UpdatePackage swagger:route PUT /namespaces/{namespace}/packages/{packageName} Packages updatePackage 35 | 36 | Create or update a package 37 | 38 | Create or update a package 39 | 40 | */ 41 | type UpdatePackage struct { 42 | Context *middleware.Context 43 | Handler UpdatePackageHandler 44 | } 45 | 46 | func (o *UpdatePackage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewUpdatePackageParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/rules/delete_rule.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // DeleteRuleHandlerFunc turns a function with the right signature into a delete rule handler 17 | type DeleteRuleHandlerFunc func(DeleteRuleParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn DeleteRuleHandlerFunc) Handle(params DeleteRuleParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // DeleteRuleHandler interface for that can handle valid delete rule params 25 | type DeleteRuleHandler interface { 26 | Handle(DeleteRuleParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewDeleteRule creates a new http.Handler for the delete rule operation 30 | func NewDeleteRule(ctx *middleware.Context, handler DeleteRuleHandler) *DeleteRule { 31 | return &DeleteRule{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*DeleteRule swagger:route DELETE /namespaces/{namespace}/rules/{ruleName} Rules deleteRule 35 | 36 | Delete a rule 37 | 38 | Delete a rule 39 | 40 | */ 41 | type DeleteRule struct { 42 | Context *middleware.Context 43 | Handler DeleteRuleHandler 44 | } 45 | 46 | func (o *DeleteRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewDeleteRuleParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/rules/delete_rule_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewDeleteRuleParams creates a new DeleteRuleParams object 18 | // no default values defined in spec. 19 | func NewDeleteRuleParams() DeleteRuleParams { 20 | 21 | return DeleteRuleParams{} 22 | } 23 | 24 | // DeleteRuleParams contains all the bound params for the delete rule operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters deleteRule 28 | type DeleteRuleParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*The entity namespace 34 | Required: true 35 | In: path 36 | */ 37 | Namespace string 38 | /*Name of rule to delete 39 | Required: true 40 | In: path 41 | */ 42 | RuleName string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewDeleteRuleParams() beforehand. 49 | func (o *DeleteRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 55 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rRuleName, rhkRuleName, _ := route.Params.GetOK("ruleName") 60 | if err := o.bindRuleName(rRuleName, rhkRuleName, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *DeleteRuleParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Namespace = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *DeleteRuleParams) bindRuleName(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.RuleName = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/rules/delete_rule_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // DeleteRuleURL generates an URL for the delete rule operation 16 | type DeleteRuleURL struct { 17 | Namespace string 18 | RuleName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *DeleteRuleURL) WithBasePath(bp string) *DeleteRuleURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *DeleteRuleURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *DeleteRuleURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/rules/{ruleName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on DeleteRuleURL") 51 | } 52 | 53 | ruleName := o.RuleName 54 | if ruleName != "" { 55 | _path = strings.Replace(_path, "{ruleName}", ruleName, -1) 56 | } else { 57 | return nil, errors.New("RuleName is required on DeleteRuleURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *DeleteRuleURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *DeleteRuleURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *DeleteRuleURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on DeleteRuleURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on DeleteRuleURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *DeleteRuleURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/rules/get_all_rules.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetAllRulesHandlerFunc turns a function with the right signature into a get all rules handler 17 | type GetAllRulesHandlerFunc func(GetAllRulesParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetAllRulesHandlerFunc) Handle(params GetAllRulesParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetAllRulesHandler interface for that can handle valid get all rules params 25 | type GetAllRulesHandler interface { 26 | Handle(GetAllRulesParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetAllRules creates a new http.Handler for the get all rules operation 30 | func NewGetAllRules(ctx *middleware.Context, handler GetAllRulesHandler) *GetAllRules { 31 | return &GetAllRules{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetAllRules swagger:route GET /namespaces/{namespace}/rules Rules getAllRules 35 | 36 | Get all rules 37 | 38 | Get all rules 39 | 40 | */ 41 | type GetAllRules struct { 42 | Context *middleware.Context 43 | Handler GetAllRulesHandler 44 | } 45 | 46 | func (o *GetAllRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetAllRulesParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/rules/get_all_rules_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | 14 | "github.com/go-openapi/swag" 15 | ) 16 | 17 | // GetAllRulesURL generates an URL for the get all rules operation 18 | type GetAllRulesURL struct { 19 | Namespace string 20 | 21 | Limit *int64 22 | Skip *int64 23 | 24 | _basePath string 25 | // avoid unkeyed usage 26 | _ struct{} 27 | } 28 | 29 | // WithBasePath sets the base path for this url builder, only required when it's different from the 30 | // base path specified in the swagger spec. 31 | // When the value of the base path is an empty string 32 | func (o *GetAllRulesURL) WithBasePath(bp string) *GetAllRulesURL { 33 | o.SetBasePath(bp) 34 | return o 35 | } 36 | 37 | // SetBasePath sets the base path for this url builder, only required when it's different from the 38 | // base path specified in the swagger spec. 39 | // When the value of the base path is an empty string 40 | func (o *GetAllRulesURL) SetBasePath(bp string) { 41 | o._basePath = bp 42 | } 43 | 44 | // Build a url path and query string 45 | func (o *GetAllRulesURL) Build() (*url.URL, error) { 46 | var result url.URL 47 | 48 | var _path = "/namespaces/{namespace}/rules" 49 | 50 | namespace := o.Namespace 51 | if namespace != "" { 52 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 53 | } else { 54 | return nil, errors.New("Namespace is required on GetAllRulesURL") 55 | } 56 | 57 | _basePath := o._basePath 58 | if _basePath == "" { 59 | _basePath = "/api/v1" 60 | } 61 | result.Path = golangswaggerpaths.Join(_basePath, _path) 62 | 63 | qs := make(url.Values) 64 | 65 | var limit string 66 | if o.Limit != nil { 67 | limit = swag.FormatInt64(*o.Limit) 68 | } 69 | if limit != "" { 70 | qs.Set("limit", limit) 71 | } 72 | 73 | var skip string 74 | if o.Skip != nil { 75 | skip = swag.FormatInt64(*o.Skip) 76 | } 77 | if skip != "" { 78 | qs.Set("skip", skip) 79 | } 80 | 81 | result.RawQuery = qs.Encode() 82 | 83 | return &result, nil 84 | } 85 | 86 | // Must is a helper function to panic when the url builder returns an error 87 | func (o *GetAllRulesURL) Must(u *url.URL, err error) *url.URL { 88 | if err != nil { 89 | panic(err) 90 | } 91 | if u == nil { 92 | panic("url can't be nil") 93 | } 94 | return u 95 | } 96 | 97 | // String returns the string representation of the path with query string 98 | func (o *GetAllRulesURL) String() string { 99 | return o.Must(o.Build()).String() 100 | } 101 | 102 | // BuildFull builds a full url with scheme, host, path and query string 103 | func (o *GetAllRulesURL) BuildFull(scheme, host string) (*url.URL, error) { 104 | if scheme == "" { 105 | return nil, errors.New("scheme is required for a full url on GetAllRulesURL") 106 | } 107 | if host == "" { 108 | return nil, errors.New("host is required for a full url on GetAllRulesURL") 109 | } 110 | 111 | base, err := o.Build() 112 | if err != nil { 113 | return nil, err 114 | } 115 | 116 | base.Scheme = scheme 117 | base.Host = host 118 | return base, nil 119 | } 120 | 121 | // StringFull returns the string representation of a complete url 122 | func (o *GetAllRulesURL) StringFull(scheme, host string) string { 123 | return o.Must(o.BuildFull(scheme, host)).String() 124 | } 125 | -------------------------------------------------------------------------------- /restapi/operations/rules/get_rule_by_name.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetRuleByNameHandlerFunc turns a function with the right signature into a get rule by name handler 17 | type GetRuleByNameHandlerFunc func(GetRuleByNameParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetRuleByNameHandlerFunc) Handle(params GetRuleByNameParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetRuleByNameHandler interface for that can handle valid get rule by name params 25 | type GetRuleByNameHandler interface { 26 | Handle(GetRuleByNameParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetRuleByName creates a new http.Handler for the get rule by name operation 30 | func NewGetRuleByName(ctx *middleware.Context, handler GetRuleByNameHandler) *GetRuleByName { 31 | return &GetRuleByName{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetRuleByName swagger:route GET /namespaces/{namespace}/rules/{ruleName} Rules getRuleByName 35 | 36 | Get rule information 37 | 38 | Get rule information 39 | 40 | */ 41 | type GetRuleByName struct { 42 | Context *middleware.Context 43 | Handler GetRuleByNameHandler 44 | } 45 | 46 | func (o *GetRuleByName) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetRuleByNameParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/rules/get_rule_by_name_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewGetRuleByNameParams creates a new GetRuleByNameParams object 18 | // no default values defined in spec. 19 | func NewGetRuleByNameParams() GetRuleByNameParams { 20 | 21 | return GetRuleByNameParams{} 22 | } 23 | 24 | // GetRuleByNameParams contains all the bound params for the get rule by name operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters getRuleByName 28 | type GetRuleByNameParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*The entity namespace 34 | Required: true 35 | In: path 36 | */ 37 | Namespace string 38 | /*Name of rule to fetch 39 | Required: true 40 | In: path 41 | */ 42 | RuleName string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewGetRuleByNameParams() beforehand. 49 | func (o *GetRuleByNameParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 55 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rRuleName, rhkRuleName, _ := route.Params.GetOK("ruleName") 60 | if err := o.bindRuleName(rRuleName, rhkRuleName, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *GetRuleByNameParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Namespace = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *GetRuleByNameParams) bindRuleName(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.RuleName = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/rules/get_rule_by_name_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // GetRuleByNameURL generates an URL for the get rule by name operation 16 | type GetRuleByNameURL struct { 17 | Namespace string 18 | RuleName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *GetRuleByNameURL) WithBasePath(bp string) *GetRuleByNameURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *GetRuleByNameURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *GetRuleByNameURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/rules/{ruleName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on GetRuleByNameURL") 51 | } 52 | 53 | ruleName := o.RuleName 54 | if ruleName != "" { 55 | _path = strings.Replace(_path, "{ruleName}", ruleName, -1) 56 | } else { 57 | return nil, errors.New("RuleName is required on GetRuleByNameURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *GetRuleByNameURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *GetRuleByNameURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *GetRuleByNameURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on GetRuleByNameURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on GetRuleByNameURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *GetRuleByNameURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/rules/set_state.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // SetStateHandlerFunc turns a function with the right signature into a set state handler 17 | type SetStateHandlerFunc func(SetStateParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn SetStateHandlerFunc) Handle(params SetStateParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // SetStateHandler interface for that can handle valid set state params 25 | type SetStateHandler interface { 26 | Handle(SetStateParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewSetState creates a new http.Handler for the set state operation 30 | func NewSetState(ctx *middleware.Context, handler SetStateHandler) *SetState { 31 | return &SetState{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*SetState swagger:route POST /namespaces/{namespace}/rules/{ruleName} Rules setState 35 | 36 | Enable or disable a rule 37 | 38 | Enable or disable a rule 39 | 40 | */ 41 | type SetState struct { 42 | Context *middleware.Context 43 | Handler SetStateHandler 44 | } 45 | 46 | func (o *SetState) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewSetStateParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/rules/set_state_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // SetStateURL generates an URL for the set state operation 16 | type SetStateURL struct { 17 | Namespace string 18 | RuleName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *SetStateURL) WithBasePath(bp string) *SetStateURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *SetStateURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *SetStateURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/rules/{ruleName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on SetStateURL") 51 | } 52 | 53 | ruleName := o.RuleName 54 | if ruleName != "" { 55 | _path = strings.Replace(_path, "{ruleName}", ruleName, -1) 56 | } else { 57 | return nil, errors.New("RuleName is required on SetStateURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *SetStateURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *SetStateURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *SetStateURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on SetStateURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on SetStateURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *SetStateURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/rules/update_rule.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package rules 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // UpdateRuleHandlerFunc turns a function with the right signature into a update rule handler 17 | type UpdateRuleHandlerFunc func(UpdateRuleParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn UpdateRuleHandlerFunc) Handle(params UpdateRuleParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // UpdateRuleHandler interface for that can handle valid update rule params 25 | type UpdateRuleHandler interface { 26 | Handle(UpdateRuleParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewUpdateRule creates a new http.Handler for the update rule operation 30 | func NewUpdateRule(ctx *middleware.Context, handler UpdateRuleHandler) *UpdateRule { 31 | return &UpdateRule{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*UpdateRule swagger:route PUT /namespaces/{namespace}/rules/{ruleName} Rules updateRule 35 | 36 | Update a rule 37 | 38 | Update a rule 39 | 40 | */ 41 | type UpdateRule struct { 42 | Context *middleware.Context 43 | Handler UpdateRuleHandler 44 | } 45 | 46 | func (o *UpdateRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewUpdateRuleParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/triggers/delete_trigger.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // DeleteTriggerHandlerFunc turns a function with the right signature into a delete trigger handler 17 | type DeleteTriggerHandlerFunc func(DeleteTriggerParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn DeleteTriggerHandlerFunc) Handle(params DeleteTriggerParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // DeleteTriggerHandler interface for that can handle valid delete trigger params 25 | type DeleteTriggerHandler interface { 26 | Handle(DeleteTriggerParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewDeleteTrigger creates a new http.Handler for the delete trigger operation 30 | func NewDeleteTrigger(ctx *middleware.Context, handler DeleteTriggerHandler) *DeleteTrigger { 31 | return &DeleteTrigger{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*DeleteTrigger swagger:route DELETE /namespaces/{namespace}/triggers/{triggerName} Triggers deleteTrigger 35 | 36 | Delete a trigger 37 | 38 | Delete a trigger 39 | 40 | */ 41 | type DeleteTrigger struct { 42 | Context *middleware.Context 43 | Handler DeleteTriggerHandler 44 | } 45 | 46 | func (o *DeleteTrigger) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewDeleteTriggerParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/triggers/delete_trigger_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewDeleteTriggerParams creates a new DeleteTriggerParams object 18 | // no default values defined in spec. 19 | func NewDeleteTriggerParams() DeleteTriggerParams { 20 | 21 | return DeleteTriggerParams{} 22 | } 23 | 24 | // DeleteTriggerParams contains all the bound params for the delete trigger operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters deleteTrigger 28 | type DeleteTriggerParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*The entity namespace 34 | Required: true 35 | In: path 36 | */ 37 | Namespace string 38 | /*Name of trigger to delete 39 | Required: true 40 | In: path 41 | */ 42 | TriggerName string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewDeleteTriggerParams() beforehand. 49 | func (o *DeleteTriggerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 55 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rTriggerName, rhkTriggerName, _ := route.Params.GetOK("triggerName") 60 | if err := o.bindTriggerName(rTriggerName, rhkTriggerName, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *DeleteTriggerParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Namespace = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *DeleteTriggerParams) bindTriggerName(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.TriggerName = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/triggers/delete_trigger_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // DeleteTriggerURL generates an URL for the delete trigger operation 16 | type DeleteTriggerURL struct { 17 | Namespace string 18 | TriggerName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *DeleteTriggerURL) WithBasePath(bp string) *DeleteTriggerURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *DeleteTriggerURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *DeleteTriggerURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/triggers/{triggerName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on DeleteTriggerURL") 51 | } 52 | 53 | triggerName := o.TriggerName 54 | if triggerName != "" { 55 | _path = strings.Replace(_path, "{triggerName}", triggerName, -1) 56 | } else { 57 | return nil, errors.New("TriggerName is required on DeleteTriggerURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *DeleteTriggerURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *DeleteTriggerURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *DeleteTriggerURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on DeleteTriggerURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on DeleteTriggerURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *DeleteTriggerURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/triggers/fire_trigger.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // FireTriggerHandlerFunc turns a function with the right signature into a fire trigger handler 17 | type FireTriggerHandlerFunc func(FireTriggerParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn FireTriggerHandlerFunc) Handle(params FireTriggerParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // FireTriggerHandler interface for that can handle valid fire trigger params 25 | type FireTriggerHandler interface { 26 | Handle(FireTriggerParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewFireTrigger creates a new http.Handler for the fire trigger operation 30 | func NewFireTrigger(ctx *middleware.Context, handler FireTriggerHandler) *FireTrigger { 31 | return &FireTrigger{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*FireTrigger swagger:route POST /namespaces/{namespace}/triggers/{triggerName} Triggers fireTrigger 35 | 36 | Fire a trigger 37 | 38 | Fire a trigger 39 | 40 | */ 41 | type FireTrigger struct { 42 | Context *middleware.Context 43 | Handler FireTriggerHandler 44 | } 45 | 46 | func (o *FireTrigger) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewFireTriggerParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/triggers/fire_trigger_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime" 13 | "github.com/go-openapi/runtime/middleware" 14 | 15 | strfmt "github.com/go-openapi/strfmt" 16 | ) 17 | 18 | // NewFireTriggerParams creates a new FireTriggerParams object 19 | // no default values defined in spec. 20 | func NewFireTriggerParams() FireTriggerParams { 21 | 22 | return FireTriggerParams{} 23 | } 24 | 25 | // FireTriggerParams contains all the bound params for the fire trigger operation 26 | // typically these are obtained from a http.Request 27 | // 28 | // swagger:parameters fireTrigger 29 | type FireTriggerParams struct { 30 | 31 | // HTTP Request Object 32 | HTTPRequest *http.Request `json:"-"` 33 | 34 | /*The entity namespace 35 | Required: true 36 | In: path 37 | */ 38 | Namespace string 39 | /*The trigger payload 40 | In: body 41 | */ 42 | Payload interface{} 43 | /*Name of trigger being fired 44 | Required: true 45 | In: path 46 | */ 47 | TriggerName string 48 | } 49 | 50 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 51 | // for simple values it will use straight method calls. 52 | // 53 | // To ensure default values, the struct must have been initialized with NewFireTriggerParams() beforehand. 54 | func (o *FireTriggerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 55 | var res []error 56 | 57 | o.HTTPRequest = r 58 | 59 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 60 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if runtime.HasBody(r) { 65 | defer r.Body.Close() 66 | var body interface{} 67 | if err := route.Consumer.Consume(r.Body, &body); err != nil { 68 | res = append(res, errors.NewParseError("payload", "body", "", err)) 69 | } else { 70 | 71 | // no validation on generic interface 72 | o.Payload = body 73 | } 74 | } 75 | rTriggerName, rhkTriggerName, _ := route.Params.GetOK("triggerName") 76 | if err := o.bindTriggerName(rTriggerName, rhkTriggerName, route.Formats); err != nil { 77 | res = append(res, err) 78 | } 79 | 80 | if len(res) > 0 { 81 | return errors.CompositeValidationError(res...) 82 | } 83 | return nil 84 | } 85 | 86 | func (o *FireTriggerParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 87 | var raw string 88 | if len(rawData) > 0 { 89 | raw = rawData[len(rawData)-1] 90 | } 91 | 92 | // Required: true 93 | // Parameter is provided by construction from the route 94 | 95 | o.Namespace = raw 96 | 97 | return nil 98 | } 99 | 100 | func (o *FireTriggerParams) bindTriggerName(rawData []string, hasKey bool, formats strfmt.Registry) error { 101 | var raw string 102 | if len(rawData) > 0 { 103 | raw = rawData[len(rawData)-1] 104 | } 105 | 106 | // Required: true 107 | // Parameter is provided by construction from the route 108 | 109 | o.TriggerName = raw 110 | 111 | return nil 112 | } 113 | -------------------------------------------------------------------------------- /restapi/operations/triggers/fire_trigger_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // FireTriggerURL generates an URL for the fire trigger operation 16 | type FireTriggerURL struct { 17 | Namespace string 18 | TriggerName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *FireTriggerURL) WithBasePath(bp string) *FireTriggerURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *FireTriggerURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *FireTriggerURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/triggers/{triggerName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on FireTriggerURL") 51 | } 52 | 53 | triggerName := o.TriggerName 54 | if triggerName != "" { 55 | _path = strings.Replace(_path, "{triggerName}", triggerName, -1) 56 | } else { 57 | return nil, errors.New("TriggerName is required on FireTriggerURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *FireTriggerURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *FireTriggerURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *FireTriggerURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on FireTriggerURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on FireTriggerURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *FireTriggerURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/triggers/get_all_triggers.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetAllTriggersHandlerFunc turns a function with the right signature into a get all triggers handler 17 | type GetAllTriggersHandlerFunc func(GetAllTriggersParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetAllTriggersHandlerFunc) Handle(params GetAllTriggersParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetAllTriggersHandler interface for that can handle valid get all triggers params 25 | type GetAllTriggersHandler interface { 26 | Handle(GetAllTriggersParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetAllTriggers creates a new http.Handler for the get all triggers operation 30 | func NewGetAllTriggers(ctx *middleware.Context, handler GetAllTriggersHandler) *GetAllTriggers { 31 | return &GetAllTriggers{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetAllTriggers swagger:route GET /namespaces/{namespace}/triggers Triggers getAllTriggers 35 | 36 | Get all triggers 37 | 38 | Get all triggers 39 | 40 | */ 41 | type GetAllTriggers struct { 42 | Context *middleware.Context 43 | Handler GetAllTriggersHandler 44 | } 45 | 46 | func (o *GetAllTriggers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetAllTriggersParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/triggers/get_trigger_by_name.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // GetTriggerByNameHandlerFunc turns a function with the right signature into a get trigger by name handler 17 | type GetTriggerByNameHandlerFunc func(GetTriggerByNameParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn GetTriggerByNameHandlerFunc) Handle(params GetTriggerByNameParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // GetTriggerByNameHandler interface for that can handle valid get trigger by name params 25 | type GetTriggerByNameHandler interface { 26 | Handle(GetTriggerByNameParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewGetTriggerByName creates a new http.Handler for the get trigger by name operation 30 | func NewGetTriggerByName(ctx *middleware.Context, handler GetTriggerByNameHandler) *GetTriggerByName { 31 | return &GetTriggerByName{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*GetTriggerByName swagger:route GET /namespaces/{namespace}/triggers/{triggerName} Triggers getTriggerByName 35 | 36 | Get trigger information 37 | 38 | Get trigger information 39 | 40 | */ 41 | type GetTriggerByName struct { 42 | Context *middleware.Context 43 | Handler GetTriggerByNameHandler 44 | } 45 | 46 | func (o *GetTriggerByName) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewGetTriggerByNameParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /restapi/operations/triggers/get_trigger_by_name_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/runtime/middleware" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | ) 16 | 17 | // NewGetTriggerByNameParams creates a new GetTriggerByNameParams object 18 | // no default values defined in spec. 19 | func NewGetTriggerByNameParams() GetTriggerByNameParams { 20 | 21 | return GetTriggerByNameParams{} 22 | } 23 | 24 | // GetTriggerByNameParams contains all the bound params for the get trigger by name operation 25 | // typically these are obtained from a http.Request 26 | // 27 | // swagger:parameters getTriggerByName 28 | type GetTriggerByNameParams struct { 29 | 30 | // HTTP Request Object 31 | HTTPRequest *http.Request `json:"-"` 32 | 33 | /*The entity namespace 34 | Required: true 35 | In: path 36 | */ 37 | Namespace string 38 | /*Name of trigger to fetch 39 | Required: true 40 | In: path 41 | */ 42 | TriggerName string 43 | } 44 | 45 | // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 46 | // for simple values it will use straight method calls. 47 | // 48 | // To ensure default values, the struct must have been initialized with NewGetTriggerByNameParams() beforehand. 49 | func (o *GetTriggerByNameParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 50 | var res []error 51 | 52 | o.HTTPRequest = r 53 | 54 | rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") 55 | if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | rTriggerName, rhkTriggerName, _ := route.Params.GetOK("triggerName") 60 | if err := o.bindTriggerName(rTriggerName, rhkTriggerName, route.Formats); err != nil { 61 | res = append(res, err) 62 | } 63 | 64 | if len(res) > 0 { 65 | return errors.CompositeValidationError(res...) 66 | } 67 | return nil 68 | } 69 | 70 | func (o *GetTriggerByNameParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { 71 | var raw string 72 | if len(rawData) > 0 { 73 | raw = rawData[len(rawData)-1] 74 | } 75 | 76 | // Required: true 77 | // Parameter is provided by construction from the route 78 | 79 | o.Namespace = raw 80 | 81 | return nil 82 | } 83 | 84 | func (o *GetTriggerByNameParams) bindTriggerName(rawData []string, hasKey bool, formats strfmt.Registry) error { 85 | var raw string 86 | if len(rawData) > 0 { 87 | raw = rawData[len(rawData)-1] 88 | } 89 | 90 | // Required: true 91 | // Parameter is provided by construction from the route 92 | 93 | o.TriggerName = raw 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /restapi/operations/triggers/get_trigger_by_name_urlbuilder.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "errors" 10 | "net/url" 11 | golangswaggerpaths "path" 12 | "strings" 13 | ) 14 | 15 | // GetTriggerByNameURL generates an URL for the get trigger by name operation 16 | type GetTriggerByNameURL struct { 17 | Namespace string 18 | TriggerName string 19 | 20 | _basePath string 21 | // avoid unkeyed usage 22 | _ struct{} 23 | } 24 | 25 | // WithBasePath sets the base path for this url builder, only required when it's different from the 26 | // base path specified in the swagger spec. 27 | // When the value of the base path is an empty string 28 | func (o *GetTriggerByNameURL) WithBasePath(bp string) *GetTriggerByNameURL { 29 | o.SetBasePath(bp) 30 | return o 31 | } 32 | 33 | // SetBasePath sets the base path for this url builder, only required when it's different from the 34 | // base path specified in the swagger spec. 35 | // When the value of the base path is an empty string 36 | func (o *GetTriggerByNameURL) SetBasePath(bp string) { 37 | o._basePath = bp 38 | } 39 | 40 | // Build a url path and query string 41 | func (o *GetTriggerByNameURL) Build() (*url.URL, error) { 42 | var result url.URL 43 | 44 | var _path = "/namespaces/{namespace}/triggers/{triggerName}" 45 | 46 | namespace := o.Namespace 47 | if namespace != "" { 48 | _path = strings.Replace(_path, "{namespace}", namespace, -1) 49 | } else { 50 | return nil, errors.New("Namespace is required on GetTriggerByNameURL") 51 | } 52 | 53 | triggerName := o.TriggerName 54 | if triggerName != "" { 55 | _path = strings.Replace(_path, "{triggerName}", triggerName, -1) 56 | } else { 57 | return nil, errors.New("TriggerName is required on GetTriggerByNameURL") 58 | } 59 | 60 | _basePath := o._basePath 61 | if _basePath == "" { 62 | _basePath = "/api/v1" 63 | } 64 | result.Path = golangswaggerpaths.Join(_basePath, _path) 65 | 66 | return &result, nil 67 | } 68 | 69 | // Must is a helper function to panic when the url builder returns an error 70 | func (o *GetTriggerByNameURL) Must(u *url.URL, err error) *url.URL { 71 | if err != nil { 72 | panic(err) 73 | } 74 | if u == nil { 75 | panic("url can't be nil") 76 | } 77 | return u 78 | } 79 | 80 | // String returns the string representation of the path with query string 81 | func (o *GetTriggerByNameURL) String() string { 82 | return o.Must(o.Build()).String() 83 | } 84 | 85 | // BuildFull builds a full url with scheme, host, path and query string 86 | func (o *GetTriggerByNameURL) BuildFull(scheme, host string) (*url.URL, error) { 87 | if scheme == "" { 88 | return nil, errors.New("scheme is required for a full url on GetTriggerByNameURL") 89 | } 90 | if host == "" { 91 | return nil, errors.New("host is required for a full url on GetTriggerByNameURL") 92 | } 93 | 94 | base, err := o.Build() 95 | if err != nil { 96 | return nil, err 97 | } 98 | 99 | base.Scheme = scheme 100 | base.Host = host 101 | return base, nil 102 | } 103 | 104 | // StringFull returns the string representation of a complete url 105 | func (o *GetTriggerByNameURL) StringFull(scheme, host string) string { 106 | return o.Must(o.BuildFull(scheme, host)).String() 107 | } 108 | -------------------------------------------------------------------------------- /restapi/operations/triggers/update_trigger.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package triggers 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the generate command 7 | 8 | import ( 9 | "net/http" 10 | 11 | middleware "github.com/go-openapi/runtime/middleware" 12 | 13 | models "github.com/projectodd/kwsk/models" 14 | ) 15 | 16 | // UpdateTriggerHandlerFunc turns a function with the right signature into a update trigger handler 17 | type UpdateTriggerHandlerFunc func(UpdateTriggerParams, *models.Principal) middleware.Responder 18 | 19 | // Handle executing the request and returning a response 20 | func (fn UpdateTriggerHandlerFunc) Handle(params UpdateTriggerParams, principal *models.Principal) middleware.Responder { 21 | return fn(params, principal) 22 | } 23 | 24 | // UpdateTriggerHandler interface for that can handle valid update trigger params 25 | type UpdateTriggerHandler interface { 26 | Handle(UpdateTriggerParams, *models.Principal) middleware.Responder 27 | } 28 | 29 | // NewUpdateTrigger creates a new http.Handler for the update trigger operation 30 | func NewUpdateTrigger(ctx *middleware.Context, handler UpdateTriggerHandler) *UpdateTrigger { 31 | return &UpdateTrigger{Context: ctx, Handler: handler} 32 | } 33 | 34 | /*UpdateTrigger swagger:route PUT /namespaces/{namespace}/triggers/{triggerName} Triggers updateTrigger 35 | 36 | Update a trigger 37 | 38 | Update a trigger 39 | 40 | */ 41 | type UpdateTrigger struct { 42 | Context *middleware.Context 43 | Handler UpdateTriggerHandler 44 | } 45 | 46 | func (o *UpdateTrigger) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 47 | route, rCtx, _ := o.Context.RouteInfo(r) 48 | if rCtx != nil { 49 | r = rCtx 50 | } 51 | var Params = NewUpdateTriggerParams() 52 | 53 | uprinc, aCtx, err := o.Context.Authorize(r, route) 54 | if err != nil { 55 | o.Context.Respond(rw, r, route.Produces, route, err) 56 | return 57 | } 58 | if aCtx != nil { 59 | r = aCtx 60 | } 61 | var principal *models.Principal 62 | if uprinc != nil { 63 | principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 64 | } 65 | 66 | if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 67 | o.Context.Respond(rw, r, route.Produces, route, err) 68 | return 69 | } 70 | 71 | res := o.Handler.Handle(Params, principal) // actually handle the request 72 | 73 | o.Context.Respond(rw, r, route.Produces, route, res) 74 | 75 | } 76 | -------------------------------------------------------------------------------- /test/bin/build-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | IMAGE_PREFIX=${IMAGE_PREFIX:-"projectodd"} 6 | IMAGE_TAG=${IMAGE_TAG:-"latest"} 7 | IMAGE_PUSH=${IMAGE_PUSH:-"false"} 8 | 9 | pushd cmd/kwsk-runtime-shim 10 | go build 11 | CGO_ENABLED=0 go build -a -o kwsk-runtime-shim.cgo 12 | docker build -f Dockerfile.nodejs6 . --tag ${IMAGE_PREFIX}/kwsk-nodejs6action:${IMAGE_TAG} 13 | docker build -f Dockerfile.nodejs8 . --tag ${IMAGE_PREFIX}/kwsk-action-nodejs-v8:${IMAGE_TAG} 14 | docker build -f Dockerfile.python2 . --tag ${IMAGE_PREFIX}/kwsk-python2action:${IMAGE_TAG} 15 | docker build -f Dockerfile.python3 . --tag ${IMAGE_PREFIX}/kwsk-python3action:${IMAGE_TAG} 16 | docker build -f Dockerfile.java8 . --tag ${IMAGE_PREFIX}/kwsk-java8action:${IMAGE_TAG} 17 | docker images 18 | if [ "$IMAGE_PUSH" == "true" ]; then 19 | echo "$DOCKER_PASSWORD" | docker login -u "${DOCKER_USER}" --password-stdin 20 | docker push ${IMAGE_PREFIX}/kwsk-nodejs6action:${IMAGE_TAG} 21 | docker push ${IMAGE_PREFIX}/kwsk-action-nodejs-v8:${IMAGE_TAG} 22 | docker push ${IMAGE_PREFIX}/kwsk-python2action:${IMAGE_TAG} 23 | docker push ${IMAGE_PREFIX}/kwsk-python2action:${IMAGE_TAG} 24 | docker push ${IMAGE_PREFIX}/kwsk-java8action:${IMAGE_TAG} 25 | fi 26 | popd 27 | -------------------------------------------------------------------------------- /test/bin/integs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | SCRIPTDIR=$(cd $(dirname "$0") && pwd) 6 | TESTDIR="$SCRIPTDIR/.." 7 | 8 | OWSK_HOME=$TESTDIR/openwhisk 9 | KWSK_PORT=8180 10 | 11 | IMAGE_PREFIX=${IMAGE_PREFIX:-"projectodd"} 12 | IMAGE_TAG=${IMAGE_TAG:-"latest"} 13 | 14 | if [ ! -d "$OWSK_HOME" ]; then 15 | git clone -b kwsk-tests --single-branch https://github.com/projectodd/incubator-openwhisk.git $OWSK_HOME 16 | cp $TESTDIR/etc/openwhisk-server-cert.pem $OWSK_HOME/ansible/roles/nginx/files/ 17 | fi 18 | sed -e "s:OPENWHISK_HOME:$OWSK_HOME:; s/:8080/:$KWSK_PORT/" <$TESTDIR/etc/whisk.properties >$OWSK_HOME/whisk.properties 19 | 20 | cat >$OWSK_HOME/tests/src/test/resources/application.conf <kwsk.log 2>&1 & 42 | KWSK_PID=$! 43 | 44 | pushd $OWSK_HOME 45 | TERM=dumb ./gradlew :tests:test --tests ${TESTS:-"system.basic.WskAction*"} 46 | STATUS=$? 47 | popd 48 | 49 | pkill -P "$KWSK_PID" 50 | exit $STATUS 51 | -------------------------------------------------------------------------------- /test/bin/knative-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | 4 | # One of release.yaml, release-lite.yaml, or release-no-mon.yaml 5 | KNATIVE_SERVING_FLAVOR=${KNATIVE_SERVING_FLAVOR:-release-no-mon.yaml} 6 | 7 | wait_for_pods() { 8 | namespace=$1 9 | timeout=600 # in seconds 10 | interval=5 # in seconds 11 | elapsed=0 12 | passed=false 13 | sleep $interval 14 | until [ $elapsed -ge $timeout ]; do 15 | kubectl get pods -n $namespace | grep -v -E "(Running|Completed|STATUS)" 16 | exit_status=$? 17 | if [ $exit_status -eq 1 ]; then 18 | passed=true 19 | break 20 | fi 21 | 22 | let elapsed=elapsed+$interval 23 | sleep $interval 24 | done 25 | if [ "$passed" = false ]; then 26 | echo "Failed to deploy pods in $namespace within $timeout seconds" 27 | kubectl get pods -o wide -n $namespace 28 | kubectl describe pods -n $namespace 29 | kubectl get all --all-namespaces 30 | kubectl describe node 31 | kubectl get events 32 | exit 1 33 | fi 34 | } 35 | 36 | # install istio 37 | kubectl apply -f https://storage.googleapis.com/knative-releases/serving/latest/istio.yaml 38 | 39 | # Don't try to inject in the istio-system namespace 40 | kubectl label namespace istio-system istio-injection=disabled 41 | # label the default namespace with istio-injection=enabled. 42 | kubectl label namespace default istio-injection=enabled 43 | 44 | wait_for_pods "istio-system" 45 | 46 | 47 | # install knative 48 | kubectl apply -f https://storage.googleapis.com/knative-releases/serving/latest/${KNATIVE_SERVING_FLAVOR} 49 | 50 | wait_for_pods "knative-serving" 51 | 52 | # install knative eventing 53 | kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release.yaml 54 | wait_for_pods "knative-eventing" 55 | 56 | # and the stub bus 57 | kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release-bus-stub.yaml 58 | kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release-clusterbus-stub.yaml 59 | # and the Kubernetes Events source 60 | kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release-source-k8sevents.yaml 61 | 62 | set +x 63 | echo "Knative successfully installed!" 64 | 65 | echo "If you're running minikube, you'll need to run these commands, too:" 66 | echo " sudo ip route add \$(cat ~/.minikube/profiles/minikube/config.json | jq -r ".KubernetesConfig.ServiceCIDR") via \$(minikube ip)" 67 | echo " kubectl run minikube-lb-patch --replicas=1 --image=elsonrodriguez/minikube-lb-patch:0.1 --namespace=kube-system" 68 | -------------------------------------------------------------------------------- /test/bin/kubeadm-dind-start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | # Use a pod network that works on Travis 4 | export POD_NETWORK_CIDR="10.244.0.0/16" 5 | 6 | # Don't snapshot the cluster 7 | export SKIP_SNAPSHOT=y 8 | 9 | # Only run on 1 Node, for now 10 | export NUM_NODES=1 11 | 12 | export EXTRA_PORTS="32380:32380" 13 | 14 | # # Add the required cluster config for Knative serving 15 | # export CONTROLLER_MANAGER_cluster_signing_cert_file="/var/lib/localkube/certs/ca.crt" 16 | # export CONTROLLER_MANAGER_cluster_signing_key_file="/var/lib/localkube/certs/ca.key" 17 | export API_SERVER_admission_controller="DenyEscalatingExec,LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook" 18 | 19 | # Not sure if this is needed, but why not 20 | bash -x dind-cluster.sh clean 21 | 22 | # Bring Kubernetes up 23 | bash -x dind-cluster.sh up 24 | 25 | # Default to the newly created kubectl context 26 | kubectl config use-context dind 27 | -------------------------------------------------------------------------------- /test/bin/minikube-start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | K8S_VERSION=${K8S_VERSION:-v1.10.5} 4 | VM_DRIVER=${VM_DRIVER:-kvm2} 5 | BOOTSTRAPPER=${BOOTSTRAPPER:-kubeadm} 6 | MINIKUBE_MEMORY=${MINIKUBE_MEMORY:-8192} 7 | MINIKUBE_CPUS=${MINIKUBE_CPUS:-4} 8 | 9 | if [ "$CI" = "true" ]; then 10 | K8S_VERSION=v1.10.0 11 | VM_DRIVER=none 12 | BOOTSTRAPPER=localkube 13 | fi 14 | 15 | exec minikube start --memory=$MINIKUBE_MEMORY --cpus=$MINIKUBE_CPUS \ 16 | --kubernetes-version=$K8S_VERSION \ 17 | --vm-driver=$VM_DRIVER \ 18 | --bootstrapper=$BOOTSTRAPPER \ 19 | --extra-config=controller-manager.cluster-signing-cert-file="/var/lib/localkube/certs/ca.crt" \ 20 | --extra-config=controller-manager.cluster-signing-key-file="/var/lib/localkube/certs/ca.key" \ 21 | --extra-config=apiserver.admission-control="DenyEscalatingExec,LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook" 22 | -------------------------------------------------------------------------------- /test/etc/action-nodejs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectodd/kwsk/1b308a6a1fd369e42126d1fc4de4660731c59a45/test/etc/action-nodejs.zip -------------------------------------------------------------------------------- /test/etc/action-python.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectodd/kwsk/1b308a6a1fd369e42126d1fc4de4660731c59a45/test/etc/action-python.zip -------------------------------------------------------------------------------- /test/etc/action.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectodd/kwsk/1b308a6a1fd369e42126d1fc4de4660731c59a45/test/etc/action.jar -------------------------------------------------------------------------------- /test/etc/openwhisk-server-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDKjCCAhICCQD5LVxydJ9nXjANBgkqhkiG9w0BAQsFADBXMQswCQYDVQQGEwJV 3 | UzELMAkGA1UECAwCTlkxETAPBgNVBAcMCFlvcmt0b3duMRIwEAYDVQQKDAlPcGVu 4 | V2hpc2sxFDASBgNVBAMMCyoubG9jYWxob3N0MB4XDTE4MDcxMTE4MTUxMFoXDTE5 5 | MDcxMTE4MTUxMFowVzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMREwDwYDVQQH 6 | DAhZb3JrdG93bjESMBAGA1UECgwJT3BlbldoaXNrMRQwEgYDVQQDDAsqLmxvY2Fs 7 | aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANV5NenGqgHXH9zS 8 | E1XBbKlx3HkH9dJT45Sk+Q4Pm2yT8EvvaagLGDptLyz+Be9ku/wPSH4DLJMlG0bL 9 | piZcUs0eSXuKGzFUEAgQeX8/dEcynWqiLK2XcIZqAX6/VXVKjiY3FD3tEzthVu0B 10 | ztKT9VsCEAX79vZ9YrZIi5TGTiYDUlnJhWOx4I/+1gzPsDP11sPZSghdyfRrF7PZ 11 | wO9AJX//m75Wz30lYCt0+LCHAWZdW/jryrPt+M69sRo1u2W79UvjFpRv9+NmxJRa 12 | E6vjdSoESx9a0z3R2X2P6od4WHgTeNesQaEO98Fe+iZvlPpNQ31beOEavBP0VcC4 13 | 2YgcspUCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAbwni3ndqZwk23zjyf+iFEknR 14 | rSSUak8Oq3NFzUHoSJ5gPhg4kN7cTBlCxXrPL6ZVlBxI6MlieSZxXu22peHktrxn 15 | 3/rWibf/J5K5yJ3bFDZP6/LF/RwiHj7lMTcVo7K7Z5VCrW4fSxp0HZJIX3oacrzw 16 | LlflSkdwuXA3ywRmhd1SftvlO1G/yXgSwMaR2eEaZAeOeiXizaRB5itsWMlEp1Tw 17 | KW0Y1VJVirVqcififMlVnVLNjlk1mdxX4xTIVNgIKrcBXFxAnep6MlltXVpeu9jN 18 | oYASw52SCVsJply76lUC6MIkORCP/o4tM2+JAHtSA9u3KRXIVJnFTBh1RNk9jA== 19 | -----END CERTIFICATE----- 20 | --------------------------------------------------------------------------------