├── .dockerignore ├── .drone.yml ├── .gitignore ├── Dockerfile.dapper ├── LICENSE ├── Makefile ├── README.md ├── backend ├── backend.go ├── backend_test.go └── pong_handler.go ├── common └── common.go ├── k8s ├── lookup.go ├── netes_proxy.go └── router.go ├── main.go ├── proxy ├── access.go ├── apiinterceptor │ ├── filters │ │ ├── api_filter.go │ │ ├── auth │ │ │ └── rancher_token_validate_filter.go │ │ └── http │ │ │ └── generic_http_filter.go │ ├── handler.go │ ├── interceptor.go │ ├── model │ │ ├── filter_model.go │ │ └── proxy_error.go │ └── router_constructor.go ├── backend_handler.go ├── backend_http_pipe.go ├── backend_http_reader.go ├── backend_http_writer.go ├── backend_proxy_manager.go ├── config.go ├── frontend_handler.go ├── frontend_http_handler.go ├── frontend_switcher.go ├── integration_test.go ├── interceptor_test.go ├── multiplexer.go ├── proxy.go ├── proxyprotocol │ ├── context.go │ ├── http_integration.go │ └── proxy_protocol.go ├── stats_handler.go ├── tls │ └── splitter.go ├── token.go └── websocket │ └── proxy.go ├── scripts ├── build ├── ci ├── entry ├── package ├── release ├── test ├── validate └── version ├── testutils ├── private.pem ├── public.pem └── utils.go ├── tools ├── local-deploy.sh └── local-run.sh ├── trash.conf └── vendor ├── github.com ├── Sirupsen │ └── logrus │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── alt_exit.go │ │ ├── doc.go │ │ ├── entry.go │ │ ├── exported.go │ │ ├── formatter.go │ │ ├── hooks.go │ │ ├── json_formatter.go │ │ ├── logger.go │ │ ├── logrus.go │ │ ├── terminal_bsd.go │ │ ├── terminal_linux.go │ │ ├── terminal_notwindows.go │ │ ├── terminal_solaris.go │ │ ├── terminal_windows.go │ │ ├── text_formatter.go │ │ └── writer.go ├── dgrijalva │ └── jwt-go │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── VERSION_HISTORY.md │ │ ├── doc.go │ │ ├── errors.go │ │ ├── hmac.go │ │ ├── jwt.go │ │ ├── rsa.go │ │ ├── rsa_utils.go │ │ └── signing_method.go ├── docker │ └── go-connections │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── MAINTAINERS │ │ ├── README.md │ │ ├── circle.yml │ │ └── tlsconfig │ │ ├── certpool_go17.go │ │ ├── certpool_other.go │ │ ├── config.go │ │ ├── config_client_ciphers.go │ │ └── config_legacy_client_ciphers.go ├── gorilla │ ├── context │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── context.go │ │ └── doc.go │ ├── mux │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── context_gorilla.go │ │ ├── context_native.go │ │ ├── doc.go │ │ ├── mux.go │ │ ├── regexp.go │ │ └── route.go │ └── websocket │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── client.go │ │ ├── conn.go │ │ ├── doc.go │ │ ├── json.go │ │ ├── server.go │ │ └── util.go ├── patrickmn │ └── go-cache │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cache.go │ │ └── sharded.go ├── pborman │ └── uuid │ │ ├── .travis.yml │ │ ├── CONTRIBUTING.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dce.go │ │ ├── doc.go │ │ ├── hash.go │ │ ├── json.go │ │ ├── node.go │ │ ├── sql.go │ │ ├── time.go │ │ ├── util.go │ │ ├── uuid.go │ │ ├── version1.go │ │ └── version4.go ├── pkg │ └── errors │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go ├── rakyll │ ├── globalconf │ │ ├── .travis.yml │ │ ├── README.md │ │ └── globalconf.go │ └── goini │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── empty.ini │ │ ├── example.ini │ │ └── ini.go └── rancher │ └── go-rancher │ ├── .dockerignore │ ├── .drone.yml │ ├── .gitignore │ ├── Dockerfile.dapper │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── trash.conf │ └── v3 │ ├── client.go │ ├── common.go │ ├── generated_account.go │ ├── generated_add_outputs_input.go │ ├── generated_agent.go │ ├── generated_amazonec2config.go │ ├── generated_api_key.go │ ├── generated_audit_log.go │ ├── generated_azure_config.go │ ├── generated_azureadconfig.go │ ├── generated_base_machine_config.go │ ├── generated_blkio_device_option.go │ ├── generated_certificate.go │ ├── generated_change_secret_input.go │ ├── generated_client.go │ ├── generated_cluster.go │ ├── generated_cluster_identity.go │ ├── generated_cluster_membership.go │ ├── generated_compose_config.go │ ├── generated_compose_config_input.go │ ├── generated_container.go │ ├── generated_container_config.go │ ├── generated_container_exec.go │ ├── generated_container_logs.go │ ├── generated_container_proxy.go │ ├── generated_container_upgrade.go │ ├── generated_credential.go │ ├── generated_databasechangelog.go │ ├── generated_databasechangeloglock.go │ ├── generated_default_network.go │ ├── generated_depends_on.go │ ├── generated_deployment_sync_request.go │ ├── generated_deployment_sync_response.go │ ├── generated_deployment_unit.go │ ├── generated_digitalocean_config.go │ ├── generated_dns_service.go │ ├── generated_dynamic_schema.go │ ├── generated_environment_info.go │ ├── generated_error.go │ ├── generated_external_dns_event.go │ ├── generated_external_event.go │ ├── generated_external_host_event.go │ ├── generated_external_service.go │ ├── generated_external_service_event.go │ ├── generated_field_documentation.go │ ├── generated_generic_object.go │ ├── generated_ha_membership.go │ ├── generated_healthcheck_info.go │ ├── generated_healthcheck_state.go │ ├── generated_host.go │ ├── generated_host_access.go │ ├── generated_host_api_proxy_token.go │ ├── generated_host_info.go │ ├── generated_host_template.go │ ├── generated_identity.go │ ├── generated_in_service_upgrade_strategy.go │ ├── generated_instance.go │ ├── generated_instance_console.go │ ├── generated_instance_console_input.go │ ├── generated_instance_health_check.go │ ├── generated_instance_info.go │ ├── generated_instance_remove.go │ ├── generated_instance_status.go │ ├── generated_instance_stop.go │ ├── generated_k8s_client_config.go │ ├── generated_k8s_server_config.go │ ├── generated_launch_config.go │ ├── generated_lb_config.go │ ├── generated_lb_target_config.go │ ├── generated_ldapconfig.go │ ├── generated_link.go │ ├── generated_load_balancer_cookie_stickiness_policy.go │ ├── generated_load_balancer_service.go │ ├── generated_local_auth_config.go │ ├── generated_log_config.go │ ├── generated_machine_driver.go │ ├── generated_metadata_object.go │ ├── generated_metadata_sync_request.go │ ├── generated_mount.go │ ├── generated_mount_entry.go │ ├── generated_network.go │ ├── generated_network_driver.go │ ├── generated_network_driver_service.go │ ├── generated_network_info.go │ ├── generated_network_policy_rule.go │ ├── generated_network_policy_rule_between.go │ ├── generated_network_policy_rule_member.go │ ├── generated_network_policy_rule_within.go │ ├── generated_openldapconfig.go │ ├── generated_packet_config.go │ ├── generated_password.go │ ├── generated_port_rule.go │ ├── generated_process_execution.go │ ├── generated_process_instance.go │ ├── generated_process_pool.go │ ├── generated_process_summary.go │ ├── generated_project.go │ ├── generated_project_member.go │ ├── generated_public_endpoint.go │ ├── generated_publish.go │ ├── generated_pull_task.go │ ├── generated_register.go │ ├── generated_registration_token.go │ ├── generated_registry.go │ ├── generated_registry_credential.go │ ├── generated_restart_policy.go │ ├── generated_revision.go │ ├── generated_scaling_group.go │ ├── generated_scheduled_upgrade.go │ ├── generated_secret.go │ ├── generated_secret_reference.go │ ├── generated_selector_service.go │ ├── generated_service.go │ ├── generated_service_event.go │ ├── generated_service_info.go │ ├── generated_service_log.go │ ├── generated_service_proxy.go │ ├── generated_service_rollback.go │ ├── generated_service_upgrade.go │ ├── generated_service_upgrade_strategy.go │ ├── generated_services_port_range.go │ ├── generated_set_compute_flavor_input.go │ ├── generated_set_project_members_input.go │ ├── generated_setting.go │ ├── generated_stack.go │ ├── generated_stack_configuration.go │ ├── generated_stack_info.go │ ├── generated_stack_upgrade.go │ ├── generated_stats_access.go │ ├── generated_storage_driver.go │ ├── generated_storage_driver_service.go │ ├── generated_storage_pool.go │ ├── generated_subnet.go │ ├── generated_subscribe.go │ ├── generated_target_port_rule.go │ ├── generated_type_documentation.go │ ├── generated_ulimit.go │ ├── generated_virtual_machine.go │ ├── generated_virtual_machine_disk.go │ ├── generated_volume.go │ ├── generated_volume_activate_input.go │ ├── generated_volume_template.go │ ├── schemas.go │ └── types.go └── gopkg.in └── check.v1 ├── .gitignore ├── LICENSE ├── README.md ├── TODO ├── benchmark.go ├── check.go ├── checkers.go ├── helpers.go ├── printer.go ├── reporter.go └── run.go /.dockerignore: -------------------------------------------------------------------------------- 1 | ./bin 2 | ./.dapper 3 | ./dist 4 | ./.trash-cache 5 | -------------------------------------------------------------------------------- /.drone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | pipeline: 3 | build: 4 | privileged: true 5 | image: rancher/dapper:1.11.2 6 | volumes: 7 | - /var/run/docker.sock:/var/run/docker.sock 8 | commands: 9 | - dapper ci 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | .DS_Store 26 | 27 | *.sw[lmpon] 28 | 29 | dist 30 | websocket-proxy 31 | -------------------------------------------------------------------------------- /Dockerfile.dapper: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 2 | RUN go get github.com/rancher/trash 3 | RUN go get github.com/golang/lint/golint 4 | RUN curl -sL https://get.docker.com/builds/Linux/x86_64/docker-1.9.1 > /usr/bin/docker && \ 5 | chmod +x /usr/bin/docker 6 | RUN apt-get update && \ 7 | apt-get install -y xz-utils 8 | ENV PATH /go/bin:$PATH 9 | ENV DAPPER_SOURCE /go/src/github.com/rancher/websocket-proxy 10 | ENV DAPPER_OUTPUT bin dist 11 | ENV DAPPER_DOCKER_SOCKET true 12 | ENV DAPPER_ENV TAG REPO 13 | ENV GO15VENDOREXPERIMENT 1 14 | ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache 15 | WORKDIR ${DAPPER_SOURCE} 16 | ENTRYPOINT ["./scripts/entry"] 17 | CMD ["ci"] 18 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TARGETS := $(shell ls scripts) 2 | 3 | .dapper: 4 | @echo Downloading dapper 5 | @curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp 6 | @@chmod +x .dapper.tmp 7 | @./.dapper.tmp -v 8 | @mv .dapper.tmp .dapper 9 | 10 | $(TARGETS): .dapper 11 | ./.dapper $@ 12 | 13 | trash: .dapper 14 | ./.dapper -m bind trash 15 | 16 | trash-keep: .dapper 17 | ./.dapper -m bind trash -k 18 | 19 | deps: trash 20 | 21 | .DEFAULT_GOAL := ci 22 | 23 | .PHONY: $(TARGETS) 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # websocket-proxy [![Build Status](http://ci.rancher.io/api/badge/github.com/rancher/websocket-proxy/status.svg?branch=master)](http://ci.rancher.io/github.com/rancher/websocket-proxy) 2 | 3 | Serves as a proxy for the websocket connections made to a Rancher host to obtain stats, view container logs, or perform docker execs. 4 | 5 | ## Contact 6 | Please submit bugs and issues to [rancher/rancher](//github.com/rancher/rancher/issues) with a title starting with `[websocket-proxy] `. 7 | 8 | Or just [click here](//github.com/rancher/rancher/issues/new?title=%5Bwebsocket-proxy%5D%20) to create a new issue. 9 | 10 | 11 | # License 12 | Copyright (c) 2014-2015 [Rancher Labs, Inc.](http://rancher.com) 13 | 14 | Licensed under the Apache License, Version 2.0 (the "License"); 15 | you may not use this file except in compliance with the License. 16 | You may obtain a copy of the License at 17 | 18 | [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 19 | 20 | Unless required by applicable law or agreed to in writing, software 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | -------------------------------------------------------------------------------- /backend/pong_handler.go: -------------------------------------------------------------------------------- 1 | package backend 2 | 3 | import ( 4 | "sync" 5 | "time" 6 | 7 | "github.com/Sirupsen/logrus" 8 | "github.com/gorilla/websocket" 9 | ) 10 | 11 | func newPongHandler(ws *websocket.Conn) *pongHandler { 12 | ph := &pongHandler{ 13 | mu: &sync.Mutex{}, 14 | lastPing: time.Now(), 15 | ws: ws, 16 | } 17 | 18 | go ph.startTimer(5000, 10000) 19 | 20 | return ph 21 | } 22 | 23 | type pongHandler struct { 24 | mu *sync.Mutex 25 | lastPing time.Time 26 | ws *websocket.Conn 27 | } 28 | 29 | func (h *pongHandler) startTimer(checkInterval, maxWait int) { 30 | ticker := time.NewTicker(time.Millisecond * time.Duration(checkInterval)) 31 | defer ticker.Stop() 32 | for range ticker.C { 33 | h.mu.Lock() 34 | t := h.lastPing 35 | timeoutAt := t.Add(time.Millisecond * time.Duration(maxWait)) 36 | h.mu.Unlock() 37 | if time.Now().After(timeoutAt) { 38 | logrus.Warnf("Hit websocket pong timeout. Last websocket ping received at %v. Closing connection.", t) 39 | h.ws.Close() 40 | return 41 | } 42 | } 43 | } 44 | 45 | func (h *pongHandler) handle(appData string) error { 46 | h.mu.Lock() 47 | defer h.mu.Unlock() 48 | h.lastPing = time.Now() 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /common/common.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | const ( 9 | MessageFormat = "%s||%s||%s" // message key || message type || message body 10 | MessageSeparator = "||" 11 | ) 12 | 13 | type MessageType string 14 | 15 | const ( 16 | Connect MessageType = "0" 17 | Body MessageType = "1" 18 | Close MessageType = "2" 19 | ) 20 | 21 | func FormatMessage(msgKey string, messageType MessageType, body string) string { 22 | return fmt.Sprintf(MessageFormat, msgKey, messageType, body) 23 | } 24 | 25 | func ParseMessage(rawMessage string) Message { 26 | parts := strings.SplitN(string(rawMessage), MessageSeparator, 3) 27 | return Message{ 28 | Key: parts[0], 29 | Type: MessageType(parts[1]), 30 | Body: parts[2], 31 | } 32 | } 33 | 34 | type Message struct { 35 | Key string 36 | Type MessageType 37 | Body string 38 | } 39 | 40 | type HTTPMessage struct { 41 | Hijack bool `json:"hijack,omitempty"` 42 | Host string `json:"host,omitempty"` 43 | Method string `json:"method,omitempty"` 44 | URL string `json:"url,omitempty"` 45 | Headers map[string][]string `json:"headers,omitempty"` 46 | Code int `json:"code,omitempty"` 47 | Body []byte `json:"body,omitempty"` 48 | EOF bool `json:"eof,omitempty"` 49 | } 50 | -------------------------------------------------------------------------------- /k8s/netes_proxy.go: -------------------------------------------------------------------------------- 1 | package k8s 2 | 3 | import ( 4 | "net/http" 5 | "net/http/httputil" 6 | "net/url" 7 | "time" 8 | 9 | "github.com/rancher/websocket-proxy/proxy/websocket" 10 | ) 11 | 12 | const ( 13 | scheme = "http" 14 | addr = "localhost:8089" 15 | ) 16 | 17 | type netesProxy struct { 18 | httpProxy *httputil.ReverseProxy 19 | } 20 | 21 | func newNetesProxy() (*netesProxy, error) { 22 | u, err := url.Parse(scheme + "://" + addr) 23 | if err != nil { 24 | return nil, err 25 | } 26 | 27 | httpProxy := httputil.NewSingleHostReverseProxy(u) 28 | httpProxy.FlushInterval = 100 * time.Millisecond 29 | return &netesProxy{ 30 | httpProxy: httpProxy, 31 | }, nil 32 | } 33 | 34 | func (n *netesProxy) Handle(rw http.ResponseWriter, req *http.Request) { 35 | if websocket.ShouldProxy(req) { 36 | websocket.Proxy(scheme, addr, rw, req) 37 | } else { 38 | n.httpProxy.ServeHTTP(rw, req) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /k8s/router.go: -------------------------------------------------------------------------------- 1 | package k8s 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/Sirupsen/logrus" 8 | "github.com/dgrijalva/jwt-go" 9 | "github.com/gorilla/mux" 10 | ) 11 | 12 | type BackendAccess interface { 13 | AuthAndLookup(req *http.Request) (*jwt.Token, string, error) 14 | ServeRemoteHTTP(token *jwt.Token, hostKey string, rw http.ResponseWriter, req *http.Request) error 15 | } 16 | 17 | type handler struct { 18 | lookup *Lookup 19 | accessKey string 20 | secretKey string 21 | frontendHTTPHandler BackendAccess 22 | netesProxy *netesProxy 23 | } 24 | 25 | func Handler(frontendHTTPHandler BackendAccess, cattleAddr, accessKey, secretKey string) (http.Handler, error) { 26 | np, err := newNetesProxy() 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | return &handler{ 32 | lookup: NewLookup(fmt.Sprintf("http://%s/v3/clusters", cattleAddr), accessKey, secretKey), 33 | accessKey: accessKey, 34 | secretKey: secretKey, 35 | frontendHTTPHandler: frontendHTTPHandler, 36 | netesProxy: np, 37 | }, nil 38 | } 39 | 40 | func (h *handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) { 41 | cluster, _, err := h.lookup.Lookup(req) 42 | if err != nil { 43 | logrus.Errorf("Failed to find cluster: %v", err) 44 | http.Error(rw, fmt.Sprintf("Failed to find cluster: %v", err), http.StatusInternalServerError) 45 | return 46 | } 47 | if cluster == nil { 48 | http.Error(rw, "Failed to find cluster", http.StatusNotFound) 49 | return 50 | } 51 | 52 | if cluster.Embedded { 53 | h.netesProxy.Handle(rw, req) 54 | return 55 | } 56 | 57 | vars := mux.Vars(req) 58 | vars["service"] = fmt.Sprintf("k8s-api.%s", cluster.Id) 59 | 60 | //oldAuth := req.Header.Get("Authorization") 61 | req.SetBasicAuth(h.accessKey, h.secretKey) 62 | 63 | token, hostKey, err := h.frontendHTTPHandler.AuthAndLookup(req) 64 | if err != nil { 65 | http.Error(rw, fmt.Sprintf("Failed to authorize cluster: %v", err), http.StatusInternalServerError) 66 | return 67 | } 68 | 69 | //req.Header.Set("Authorization", oldAuth) 70 | req.Header.Set("Authorization", "Bearer "+cluster.K8sClientConfig.BearerToken) 71 | req.Header.Set("X-API-Cluster-Id", cluster.Id) 72 | 73 | if err := h.frontendHTTPHandler.ServeRemoteHTTP(token, hostKey, rw, req); err != nil { 74 | logrus.Errorf("Failed to forward request: %v", err) 75 | http.Error(rw, fmt.Sprintf("Failed to forward request: %v", err), http.StatusInternalServerError) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | log "github.com/Sirupsen/logrus" 5 | 6 | "github.com/rancher/websocket-proxy/proxy" 7 | ) 8 | 9 | func main() { 10 | conf, err := proxy.GetConfig() 11 | if err != nil { 12 | log.WithField("error", err).Fatal("Error getting config.") 13 | } 14 | 15 | p := &proxy.Starter{ 16 | BackendPaths: []string{ 17 | "/v1/connectbackend", 18 | }, 19 | FrontendPaths: []string{ 20 | "/v1/{logs:logs}", 21 | "/v1/{logs:logs}/", 22 | "/v1/{stats:stats}", 23 | "/v1/{stats:stats}/{statsid}", 24 | "/v1/exec/", 25 | "/v1/exec", 26 | "/v1/console/", 27 | "/v1/console", 28 | "/v1/dockersocket/", 29 | "/v1/dockersocket", 30 | }, 31 | FrontendHTTPPaths: []string{ 32 | "/v1/container-proxy{path:.*}", 33 | "/r/projects/{project}/{service}{path:.*}", 34 | "/r/{service}{path:.*}", 35 | }, 36 | StatsPaths: []string{ 37 | "/v1/{hoststats:hoststats(\\/project)?(\\/)?}", 38 | "/v1/{containerstats:containerstats(\\/service)?(\\/)?}", 39 | "/v1/{containerstats:containerstats}/{containerid}", 40 | }, 41 | CattleWSProxyPaths: []string{ 42 | "/v1/{sub:subscribe}", 43 | "/v1/projects/{project}/{sub:subscribe}", 44 | "/v2-beta/{sub:subscribe}", 45 | "/v2-beta/projects/{project}/{sub:subscribe}", 46 | "/v2/{sub:subscribe}", 47 | "/v2/projects/{project}/{sub:subscribe}", 48 | "/v3/{sub:subscribe}", 49 | "/v3/projects/{project}/{sub:subscribe}", 50 | }, 51 | CattleProxyPaths: []string{ 52 | "/{cattle-proxy:.*}", 53 | }, 54 | Config: conf, 55 | } 56 | 57 | log.Infof("Starting websocket proxy. Listening on [%s], Proxying to cattle API at [%s], Monitoring parent pid [%v].", 58 | conf.ListenAddr, conf.CattleAddr, conf.ParentPid) 59 | 60 | err = p.StartProxy() 61 | 62 | log.WithFields(log.Fields{"error": err}).Info("Exiting proxy.") 63 | } 64 | -------------------------------------------------------------------------------- /proxy/access.go: -------------------------------------------------------------------------------- 1 | // Package proxy is inspired by https://gist.github.com/cespare/3985516 2 | package proxy 3 | 4 | import ( 5 | "net/http" 6 | "strconv" 7 | "strings" 8 | "time" 9 | 10 | log "github.com/Sirupsen/logrus" 11 | ) 12 | 13 | type accessLog struct { 14 | ip, method, uri, protocol, host string 15 | elapsedTime time.Duration 16 | } 17 | 18 | func logAccess(w http.ResponseWriter, req *http.Request, duration time.Duration) { 19 | clientIP := req.RemoteAddr 20 | 21 | if colon := strings.LastIndex(clientIP, ":"); colon != -1 { 22 | clientIP = clientIP[:colon] 23 | } 24 | 25 | record := &accessLog{ 26 | ip: clientIP, 27 | method: req.Method, 28 | uri: req.RequestURI, 29 | protocol: req.Proto, 30 | host: req.Host, 31 | elapsedTime: duration, 32 | } 33 | 34 | writeAccessLog(record) 35 | } 36 | 37 | func writeAccessLog(record *accessLog) { 38 | logRecord := "" + record.ip + " " + record.protocol + " " + record.method + ": " + record.uri + ", host: " + record.host + " (load time: " + strconv.FormatFloat(record.elapsedTime.Seconds(), 'f', 5, 64) + " seconds)" 39 | log.Info(logRecord) 40 | } 41 | -------------------------------------------------------------------------------- /proxy/apiinterceptor/filters/api_filter.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | import ( 4 | "crypto/hmac" 5 | "crypto/sha512" 6 | "encoding/base64" 7 | 8 | log "github.com/Sirupsen/logrus" 9 | "github.com/rancher/websocket-proxy/proxy/apiinterceptor/model" 10 | ) 11 | 12 | type APIFilter interface { 13 | GetType() string 14 | ProcessFilter(filter model.FilterData, input model.APIRequestData) (model.APIRequestData, error) 15 | } 16 | 17 | func SignString(stringToSign []byte, sharedSecret []byte) string { 18 | h := hmac.New(sha512.New, sharedSecret) 19 | h.Write(stringToSign) 20 | 21 | signature := h.Sum(nil) 22 | encodedSignature := base64.URLEncoding.EncodeToString(signature) 23 | 24 | log.Debugf("Signature generated: %v", encodedSignature) 25 | 26 | return encodedSignature 27 | } 28 | -------------------------------------------------------------------------------- /proxy/apiinterceptor/filters/http/generic_http_filter.go: -------------------------------------------------------------------------------- 1 | package http 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "io/ioutil" 7 | "net/http" 8 | "strconv" 9 | "time" 10 | 11 | log "github.com/Sirupsen/logrus" 12 | "github.com/rancher/websocket-proxy/proxy/apiinterceptor/filters" 13 | "github.com/rancher/websocket-proxy/proxy/apiinterceptor/model" 14 | ) 15 | 16 | const ( 17 | interceptorType = "http" 18 | ) 19 | 20 | type GenericHTTPFilter struct { 21 | client *http.Client 22 | } 23 | 24 | func (f *GenericHTTPFilter) GetType() string { 25 | return interceptorType 26 | } 27 | 28 | func NewFilter() (filters.APIFilter, error) { 29 | httpFilter := &GenericHTTPFilter{ 30 | client: &http.Client{}, 31 | } 32 | log.Infof("Configured %s API filter", httpFilter.GetType()) 33 | 34 | return httpFilter, nil 35 | } 36 | 37 | func (f *GenericHTTPFilter) ProcessFilter(filter model.FilterData, input model.APIRequestData) (model.APIRequestData, error) { 38 | output := model.APIRequestData{} 39 | bodyContent, err := json.Marshal(input) 40 | if err != nil { 41 | return output, err 42 | } 43 | 44 | log.Debugf("Request => %s", bodyContent) 45 | 46 | req, err := http.NewRequest("POST", filter.Endpoint, bytes.NewBuffer(bodyContent)) 47 | if err != nil { 48 | return output, err 49 | } 50 | //sign the body 51 | if filter.SecretToken != "" { 52 | signature := filters.SignString(bodyContent, []byte(filter.SecretToken)) 53 | req.Header.Set(model.SignatureHeader, signature) 54 | } 55 | req.Header.Set("Content-Type", "application/json") 56 | req.Header.Set("Content-Length", string(len(bodyContent))) 57 | 58 | var tout int 59 | if filter.Timeout == "0" || filter.Timeout == "" { 60 | tout = 15 61 | } else { 62 | var err error 63 | tout, err = strconv.Atoi(filter.Timeout) 64 | if err != nil { 65 | tout = 15 66 | } 67 | } 68 | f.client.Timeout = time.Second * time.Duration(tout) 69 | resp, err := f.client.Do(req) 70 | if err != nil { 71 | return output, err 72 | } 73 | log.Debugf("Response Status <= " + resp.Status) 74 | defer resp.Body.Close() 75 | 76 | byteContent, err := ioutil.ReadAll(resp.Body) 77 | if err != nil { 78 | return output, err 79 | } 80 | 81 | log.Debugf("Response <= %s", byteContent) 82 | 83 | json.Unmarshal(byteContent, &output) 84 | output.Status = resp.StatusCode 85 | 86 | return output, nil 87 | } 88 | -------------------------------------------------------------------------------- /proxy/apiinterceptor/handler.go: -------------------------------------------------------------------------------- 1 | package apiinterceptor 2 | 3 | import ( 4 | "net/http" 5 | "sync" 6 | 7 | "github.com/pkg/errors" 8 | ) 9 | 10 | //APIInterceptor is a wrapper over the mux interceptor that does the path<->filters matching 11 | type APIInterceptor struct { 12 | interceptorRouter http.Handler 13 | mu *sync.RWMutex 14 | } 15 | 16 | func (h *APIInterceptor) ServeHTTP(w http.ResponseWriter, r *http.Request) { 17 | h.getRouter().ServeHTTP(w, r) 18 | } 19 | 20 | func (h *APIInterceptor) getRouter() http.Handler { 21 | h.mu.RLock() 22 | router := h.interceptorRouter 23 | h.mu.RUnlock() 24 | 25 | return router 26 | } 27 | 28 | func (h *APIInterceptor) setRouter(router http.Handler) { 29 | h.mu.Lock() 30 | h.interceptorRouter = router 31 | h.mu.Unlock() 32 | } 33 | 34 | func NewInterceptor(configFile string, cattleAddr string) (http.Handler, error) { 35 | apiInterceptor := &APIInterceptor{ 36 | mu: &sync.RWMutex{}, 37 | } 38 | 39 | router, err := newRouter(configFile, cattleAddr, apiInterceptor) 40 | if err != nil { 41 | return nil, errors.Wrap(err, "Couldn't configure api proxy handler") 42 | } 43 | 44 | apiInterceptor.setRouter(router) 45 | return apiInterceptor, nil 46 | } 47 | 48 | type routerSetter interface { 49 | setRouter(router http.Handler) 50 | } 51 | -------------------------------------------------------------------------------- /proxy/apiinterceptor/model/filter_model.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | const SignatureHeader = "X-API-Auth-Signature" 4 | 5 | //FilterData defines the properties of a pre/post API filter 6 | type FilterData struct { 7 | Type string `json:"type"` 8 | Endpoint string `json:"endpoint"` 9 | SecretToken string `json:"secretToken"` 10 | Methods []string `json:"methods"` 11 | Paths []string `json:"paths"` 12 | Timeout string `json:"timeout"` 13 | } 14 | 15 | //APIRequestData defines the properties of a API Request/Response Body sent to/from a filter 16 | type APIRequestData struct { 17 | Headers map[string][]string `json:"headers,omitempty"` 18 | Body map[string]interface{} `json:"body,omitempty"` 19 | UUID string `json:"UUID,omitempty"` 20 | APIPath string `json:"APIPath,omitempty"` 21 | APIMethod string `json:"APIMethod,omitempty"` 22 | EnvID string `json:"envID,omitempty"` 23 | Status int `json:"status,omitempty"` 24 | Message string `json:"message,omitempty"` 25 | } 26 | -------------------------------------------------------------------------------- /proxy/apiinterceptor/model/proxy_error.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | //ProxyError structure contains the error resource definition 4 | type ProxyError struct { 5 | Status string `json:"status"` 6 | Message string `json:"message"` 7 | } 8 | -------------------------------------------------------------------------------- /proxy/backend_handler.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "net/http" 5 | 6 | log "github.com/Sirupsen/logrus" 7 | "github.com/gorilla/websocket" 8 | ) 9 | 10 | type BackendHandler struct { 11 | proxyManager proxyManager 12 | parsedPublicKey interface{} 13 | } 14 | 15 | func (h *BackendHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) { 16 | log.Infof("Handling backend connection request.") 17 | hostKey, authed := h.auth(req) 18 | if !authed { 19 | http.Error(rw, "Failed authentication", 401) 20 | return 21 | } 22 | 23 | upgrader := websocket.Upgrader{ 24 | CheckOrigin: func(r *http.Request) bool { return true }, 25 | } 26 | 27 | ws, err := upgrader.Upgrade(rw, req, nil) 28 | if err != nil { 29 | log.Errorf("Error during upgrade for host [%v]: [%v]", hostKey, err) 30 | http.Error(rw, "Failed to upgrade connection.", 500) 31 | return 32 | } 33 | 34 | h.proxyManager.addBackend(hostKey, ws) 35 | } 36 | 37 | func (h *BackendHandler) auth(req *http.Request) (string, bool) { 38 | token, tokenParam, err := parseToken(req, h.parsedPublicKey) 39 | if err != nil { 40 | log.Warnf("Error parsing backend token: %v. Failing auth. Token parameter: %v", err, tokenParam) 41 | return "", false 42 | } 43 | 44 | reportedUUID, found := token.Claims["reportedUuid"] 45 | if !found { 46 | log.Warnf("Token did not have a reportedUuid. Failing auth. Token parameter: %v", tokenParam) 47 | return "", false 48 | } 49 | 50 | hostKey, ok := reportedUUID.(string) 51 | if !ok || hostKey == "" { 52 | log.Warnf("Token's reported uuid claim %v could not be parsed as a string. Token parameter: %v", reportedUUID, tokenParam) 53 | return "", false 54 | } 55 | 56 | return hostKey, true 57 | } 58 | -------------------------------------------------------------------------------- /proxy/backend_http_pipe.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/Sirupsen/logrus" 7 | ) 8 | 9 | func NewHTTPPipe(rw http.ResponseWriter, backend backendProxy, hostKey string) (*BackendHTTPReader, *BackendHTTPWriter, error) { 10 | msgKey, respChannel, err := backend.initializeClient(hostKey) 11 | if err != nil { 12 | return nil, nil, err 13 | } 14 | 15 | logrus.Debugf("BACKEND PIPE %s %s", hostKey, msgKey) 16 | 17 | if err = backend.connect(hostKey, msgKey, "/v1/container-proxy/"); err != nil { 18 | backend.closeConnection(hostKey, msgKey) 19 | return nil, nil, err 20 | } 21 | 22 | return NewBackendHTTPReader(rw, hostKey, msgKey, backend, respChannel), &BackendHTTPWriter{ 23 | hostKey: hostKey, 24 | msgKey: msgKey, 25 | backend: backend, 26 | }, nil 27 | } 28 | -------------------------------------------------------------------------------- /proxy/backend_http_writer.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | "strings" 7 | 8 | "github.com/Sirupsen/logrus" 9 | "github.com/gorilla/mux" 10 | "github.com/rancher/websocket-proxy/common" 11 | "sync" 12 | ) 13 | 14 | type BackendHTTPWriter struct { 15 | hostKey, msgKey string 16 | backend backendProxy 17 | mu sync.Mutex 18 | closed bool 19 | } 20 | 21 | func (b *BackendHTTPWriter) Close() error { 22 | b.mu.Lock() 23 | if b.closed { 24 | return nil 25 | } 26 | b.closed = true 27 | b.mu.Unlock() 28 | 29 | logrus.Debugf("BACKEND WRITE EOF %s", b.msgKey) 30 | return b.writeMessage(&common.HTTPMessage{ 31 | EOF: true, 32 | }) 33 | } 34 | 35 | func (b *BackendHTTPWriter) WriteRequest(req *http.Request, hijack bool, address, scheme string) error { 36 | vars := mux.Vars(req) 37 | 38 | headers := http.Header{} 39 | for k, v := range req.Header { 40 | headers[k] = v 41 | } 42 | 43 | url := *req.URL 44 | 45 | if req.TLS == nil { 46 | url.Scheme = "http" 47 | } else { 48 | url.Scheme = "https" 49 | } 50 | url.Host = req.Host 51 | headers.Set("X-API-request-url", url.String()) 52 | 53 | url.Host = address 54 | url.Path = vars["path"] 55 | if !strings.HasPrefix(url.Path, "/") { 56 | url.Path = "/" + url.Path 57 | } 58 | 59 | if scheme == "" { 60 | url.Scheme = "http" 61 | } else { 62 | url.Scheme = scheme 63 | } 64 | 65 | return b.writeMessage(&common.HTTPMessage{ 66 | Hijack: hijack, 67 | Host: req.Host, 68 | Method: req.Method, 69 | URL: url.String(), 70 | Headers: headers, 71 | }) 72 | } 73 | 74 | func (b *BackendHTTPWriter) writeMessage(message *common.HTTPMessage) error { 75 | data, err := json.Marshal(message) 76 | if err != nil { 77 | return err 78 | } 79 | 80 | logrus.Debugf("BACKEND WRITE %s,%s: %s", b.hostKey, b.msgKey, data) 81 | return b.backend.send(b.hostKey, b.msgKey, string(data)) 82 | } 83 | 84 | func (b *BackendHTTPWriter) Write(buffer []byte) (int, error) { 85 | return len(buffer), b.writeMessage(&common.HTTPMessage{ 86 | Body: buffer, 87 | }) 88 | } 89 | -------------------------------------------------------------------------------- /proxy/frontend_switcher.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "io/ioutil" 5 | "net/http" 6 | "os" 7 | "strings" 8 | "sync" 9 | "time" 10 | 11 | "github.com/Sirupsen/logrus" 12 | ) 13 | 14 | type Switcher struct { 15 | sync.Mutex 16 | remote http.Handler 17 | config *Config 18 | addr string 19 | } 20 | 21 | func NewSwitcher(config *Config) *Switcher { 22 | s := &Switcher{ 23 | config: config, 24 | } 25 | go s.start() 26 | return s 27 | } 28 | 29 | func (s *Switcher) Wrap(local http.Handler) http.Handler { 30 | return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { 31 | if handler := s.lookupHandler(); handler != nil { 32 | handler.ServeHTTP(rw, req) 33 | } else { 34 | local.ServeHTTP(rw, req) 35 | } 36 | }) 37 | } 38 | 39 | func (s *Switcher) lookupHandler() http.Handler { 40 | var result http.Handler 41 | s.Lock() 42 | result = s.remote 43 | s.Unlock() 44 | return result 45 | } 46 | 47 | func (s *Switcher) start() { 48 | logrus.Infof("Master config file: %s", s.config.MasterFile) 49 | if s.config.MasterFile == "" { 50 | s.clear() 51 | return 52 | } 53 | 54 | for { 55 | if err := s.readConfig(); err != nil { 56 | logrus.Errorf("Failed to read config: %v", err) 57 | } 58 | time.Sleep(5 * time.Second) 59 | } 60 | } 61 | 62 | func (s *Switcher) readConfig() error { 63 | bytes, err := ioutil.ReadFile(s.config.MasterFile) 64 | if os.IsNotExist(err) { 65 | s.clear() 66 | return nil 67 | } else if err != nil { 68 | return err 69 | } 70 | 71 | newAddr := strings.TrimSpace(string(bytes)) 72 | 73 | if newAddr == "" { 74 | s.clear() 75 | return nil 76 | } 77 | 78 | if s.addr == newAddr { 79 | return nil 80 | } 81 | 82 | s.Lock() 83 | logrus.Infof("Master address: %s", newAddr) 84 | s.addr = newAddr 85 | s.remote = newWSProxy(&Config{ 86 | CattleAddr: newAddr, 87 | }) 88 | s.Unlock() 89 | 90 | return nil 91 | } 92 | 93 | func (s *Switcher) clear() { 94 | if s.remote == nil { 95 | return 96 | } 97 | s.Lock() 98 | logrus.Infof("Master address: none, using local") 99 | s.remote = nil 100 | s.Unlock() 101 | } 102 | -------------------------------------------------------------------------------- /proxy/proxyprotocol/context.go: -------------------------------------------------------------------------------- 1 | package proxyprotocol 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | var ( 8 | mutex sync.RWMutex 9 | infos = make(map[string]*ProxyProtoInfo) 10 | ) 11 | 12 | func putInfo(clientAddr string, info *ProxyProtoInfo) { 13 | mutex.Lock() 14 | defer mutex.Unlock() 15 | infos[clientAddr] = info 16 | } 17 | 18 | func getInfo(clientAddr string) *ProxyProtoInfo { 19 | mutex.RLock() 20 | defer mutex.RUnlock() 21 | return infos[clientAddr] 22 | } 23 | 24 | func deleteInfo(clientAddr string) { 25 | mutex.Lock() 26 | defer mutex.Unlock() 27 | delete(infos, clientAddr) 28 | } 29 | -------------------------------------------------------------------------------- /proxy/proxyprotocol/http_integration.go: -------------------------------------------------------------------------------- 1 | package proxyprotocol 2 | 3 | import ( 4 | "net" 5 | "net/http" 6 | "strconv" 7 | "strings" 8 | ) 9 | 10 | const ( 11 | xForwardedProto string = "X-Forwarded-Proto" 12 | xForwardedPort string = "X-Forwarded-Port" 13 | xForwardedFor string = "X-Forwarded-For" 14 | sep string = ", " 15 | ) 16 | 17 | func AddHeaders(req *http.Request, httpsPorts map[int]bool) { 18 | proxyProtoInfo := getInfo(req.RemoteAddr) 19 | if proxyProtoInfo != nil { 20 | if h := req.Header.Get(xForwardedProto); h == "" { 21 | var proto string 22 | if _, ok := httpsPorts[proxyProtoInfo.ProxyAddr.Port]; ok { 23 | proto = "https" 24 | } else { 25 | proto = "http" 26 | } 27 | req.Header.Set(xForwardedProto, proto) 28 | } 29 | 30 | if h := req.Header.Get(xForwardedPort); h == "" { 31 | req.Header.Set(xForwardedPort, strconv.Itoa(proxyProtoInfo.ProxyAddr.Port)) 32 | } 33 | 34 | ip := proxyProtoInfo.ClientAddr.IP.String() 35 | if forwardedFors, ok := req.Header[http.CanonicalHeaderKey(xForwardedFor)]; ok { 36 | ip = strings.Join(forwardedFors, sep) + sep + ip 37 | } 38 | req.Header.Set(xForwardedFor, ip) 39 | 40 | } else if req.TLS != nil { 41 | if h := req.Header.Get(xForwardedProto); h == "" { 42 | req.Header.Set(xForwardedProto, "https") 43 | } 44 | } 45 | } 46 | 47 | func AddForwardedFor(req *http.Request) { 48 | ip := strings.Split(req.RemoteAddr, ":")[0] 49 | if forwardedFors, ok := req.Header[http.CanonicalHeaderKey(xForwardedFor)]; ok { 50 | ip = strings.Join(forwardedFors, sep) + sep + ip 51 | } 52 | req.Header.Set(xForwardedFor, ip) 53 | } 54 | 55 | func StateCleanup(conn net.Conn, connState http.ConnState) { 56 | if connState == http.StateClosed { 57 | deleteInfo(conn.RemoteAddr().String()) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /proxy/tls/splitter.go: -------------------------------------------------------------------------------- 1 | package tls 2 | 3 | import ( 4 | "bufio" 5 | "crypto/tls" 6 | "net" 7 | "time" 8 | ) 9 | 10 | type Conn struct { 11 | net.Conn 12 | bufReader *bufio.Reader 13 | err error 14 | } 15 | 16 | func (c *Conn) Read(b []byte) (int, error) { 17 | if c.err != nil { 18 | return 0, c.err 19 | } 20 | return c.bufReader.Read(b) 21 | } 22 | 23 | type SplitListener struct { 24 | net.Listener 25 | Config *tls.Config 26 | } 27 | 28 | func (l *SplitListener) Accept() (net.Conn, error) { 29 | c, err := l.Listener.Accept() 30 | if err != nil { 31 | return nil, err 32 | } 33 | 34 | newConn := &Conn{ 35 | Conn: c, 36 | bufReader: bufio.NewReader(c), 37 | } 38 | 39 | c.SetDeadline(time.Now().Add(1 * time.Second)) 40 | b, err := newConn.bufReader.Peek(1) 41 | if err != nil { 42 | newConn.err = err 43 | return newConn, nil 44 | } 45 | c.SetDeadline(time.Time{}) 46 | 47 | if b[0] < 32 || b[0] >= 127 { 48 | return tls.Server(newConn, l.Config), nil 49 | } 50 | 51 | return newConn, nil 52 | } 53 | -------------------------------------------------------------------------------- /proxy/websocket/proxy.go: -------------------------------------------------------------------------------- 1 | package websocket 2 | 3 | import ( 4 | "crypto/tls" 5 | "io" 6 | "net" 7 | "net/http" 8 | 9 | log "github.com/Sirupsen/logrus" 10 | ) 11 | 12 | func ShouldProxy(req *http.Request) bool { 13 | return len(req.Header.Get("Upgrade")) > 0 14 | } 15 | 16 | func Proxy(scheme string, targetAddr string, rw http.ResponseWriter, req *http.Request) { 17 | if scheme == "https" { 18 | ProxyTLS(targetAddr, rw, req) 19 | } else { 20 | ProxyTCP(targetAddr, rw, req) 21 | } 22 | } 23 | 24 | func ProxyTLS(targetAddr string, rw http.ResponseWriter, req *http.Request) { 25 | d, err := tls.Dial("tcp", targetAddr, nil) 26 | if err != nil { 27 | log.WithField("error", err).Error("Error dialing websocket backend.") 28 | http.Error(rw, "Unable to establish websocket connection: can't dial.", 500) 29 | return 30 | } 31 | defer d.Close() 32 | 33 | proxy(d, rw, req) 34 | } 35 | 36 | func ProxyTCP(targetAddr string, rw http.ResponseWriter, req *http.Request) { 37 | d, err := net.Dial("tcp", targetAddr) 38 | if err != nil { 39 | log.WithField("error", err).Error("Error dialing websocket backend.") 40 | http.Error(rw, "Unable to establish websocket connection: can't dial.", 500) 41 | return 42 | } 43 | defer d.Close() 44 | 45 | proxy(d, rw, req) 46 | } 47 | 48 | func proxy(conn net.Conn, rw http.ResponseWriter, req *http.Request) { 49 | // Inspired by https://groups.google.com/forum/#!searchin/golang-nuts/httputil.ReverseProxy$20$2B$20websockets/golang-nuts/KBx9pDlvFOc/01vn1qUyVdwJ 50 | 51 | hj, ok := rw.(http.Hijacker) 52 | if !ok { 53 | http.Error(rw, "Unable to establish websocket connection: no hijacker.", 500) 54 | return 55 | } 56 | nc, _, err := hj.Hijack() 57 | if err != nil { 58 | log.WithField("error", err).Error("Hijack error.") 59 | http.Error(rw, "Unable to establish websocket connection: can't hijack.", 500) 60 | return 61 | } 62 | defer nc.Close() 63 | 64 | err = req.Write(conn) 65 | if err != nil { 66 | log.WithField("error", err).Error("Error copying request to target.") 67 | return 68 | } 69 | 70 | errc := make(chan error, 2) 71 | cp := func(dst io.Writer, src io.Reader) { 72 | _, err := io.Copy(dst, src) 73 | errc <- err 74 | } 75 | go cp(conn, nc) 76 | go cp(nc, conn) 77 | <-errc 78 | 79 | return 80 | } 81 | -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | source $(dirname $0)/version 5 | 6 | cd $(dirname $0)/.. 7 | 8 | mkdir -p bin 9 | CGO_ENABLED=0 go build -ldflags "-X main.VERSION=$VERSION -linkmode external -extldflags -static" -o bin/websocket-proxy 10 | -------------------------------------------------------------------------------- /scripts/ci: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd $(dirname $0) 5 | 6 | ./build 7 | ./test 8 | ./validate 9 | ./package 10 | -------------------------------------------------------------------------------- /scripts/entry: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | trap "chown -R $DAPPER_UID:$DAPPER_GID ." exit 5 | 6 | mkdir -p bin dist 7 | if [ -e ./scripts/$1 ]; then 8 | ./scripts/"$@" 9 | else 10 | "$@" 11 | fi 12 | -------------------------------------------------------------------------------- /scripts/package: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | set -e 4 | 5 | cd $(dirname $0)/.. 6 | 7 | if [ ! -e bin/websocket-proxy ]; then 8 | ./scripts/build 9 | fi 10 | 11 | mkdir -p dist/artifacts 12 | cd bin/ 13 | tar cvJf ../dist/artifacts/websocket-proxy.tar.xz . 14 | -------------------------------------------------------------------------------- /scripts/release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exec $(dirname $0)/ci 4 | -------------------------------------------------------------------------------- /scripts/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd $(dirname $0)/.. 5 | 6 | echo Running tests 7 | 8 | PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')" 9 | 10 | go test -race -cover -tags=test ${PACKAGES} 11 | -------------------------------------------------------------------------------- /scripts/validate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd $(dirname $0)/.. 5 | 6 | echo Running validation 7 | 8 | PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')" 9 | 10 | echo Running: go vet 11 | go vet ${PACKAGES} 12 | echo Running: golint 13 | for i in ${PACKAGES}; do 14 | if [ -n "$(golint $i | grep -v 'should have comment.*or be unexported' | tee /dev/stderr)" ]; then 15 | failed=true 16 | fi 17 | done 18 | test -z "$failed" 19 | echo Running: go fmt 20 | test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)" 21 | -------------------------------------------------------------------------------- /scripts/version: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -n "$(git status --porcelain --untracked-files=no)" ]; then 4 | DIRTY="-dirty" 5 | fi 6 | 7 | COMMIT=$(git rev-parse --short HEAD) 8 | GIT_TAG=$(git tag -l --contains HEAD | head -n 1) 9 | 10 | if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then 11 | VERSION=$GIT_TAG 12 | else 13 | VERSION="${COMMIT}${DIRTY}" 14 | fi 15 | -------------------------------------------------------------------------------- /testutils/private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAvV4jSsNuxPBxLnhD+3g52U5fxP1NtGlcdpPaCgDe+jtGApTC 3 | mXCzEj/TcRqPmyFCC6OxN5RzUMm/UPyi3UmnPERX7r5tS9T5VO/0wcxN6HXQmNQJ 4 | a5h6qT0/GGEQQDnopbEe0lpKKYyzHH3shtdZpaPbksp1fDUE+dSsg2OXqy+Zn/rA 5 | oB3eCDnYQhWOO4KLf7GDB0ty+OK/2GB6Zs0H3gCRw4nYjpWWxSjv5Sq1lbL600lA 6 | hFWJC5+SdbnShxm6aXP0Kh4AR/icxBqc3mfCvzjYyE79odcLE6sjdKPAC+QiHYyy 7 | TjfmNZ6O0ObgcIRkMCq7mJ3A41Q+fv11KtssPwIDAQABAoIBAC3ZqTnk7+EHRqA1 8 | xmAQ0BDphQ6xNitEh3q+ecCKTXLQ/zaIxkVYoEL+6Tctcy/gcZlX3QTUEMey0XvO 9 | b7CcsL1K3u+Tc+s0edoy71QtH3/1ZrhaPp2qoahwh+JjPggO/WGA7TGJYwOEaamw 10 | Y6CSa8ZLUlLMan3UaIwFDnARoRt1U2I/AS7u1rsdy/eBwMe+Pqww0fMOSucd9URV 11 | Ejhp+I0zcukw8B5Ui+Y08DdP/kdWNfDqCqgH313kkz6CNhkVDde+7qLA51irz6Kr 12 | jcjpq+jSL5a4QU2AhSDAmKOdiupn4YujYqb7y7djwIJqU9rkHHvT8HomHankFEqb 13 | ghA+iGECgYEA/HHGiq94TgrEoc7Bx3oq+DDD3TBTQITxtwFl0TFd1ad/VmH2cHHg 14 | VHogO+RVAFsorWhAV0Lgba/xripbJYoaqcwa47xcoQc4K+KZ48HLMaiYkNTSfYij 15 | bcN+HpSV19/BuwyXVJAK9IKmhguMg80llMOxbMXh+6ZeRV3n6UyhTrUCgYEAwAju 16 | I0JHpBe2ytqdqU3ozIJeanjQF0MTniF58TPycIAB19ykOn/iM7qY1FR3JG3FZLp5 17 | dmtMVQWHiottUJba8bDS/fH9WnO+86XjUj1WmbINAvONqmdBo9/9oTvZRa5ASCm5 18 | UGk2IPMv68LKWn0q77DfEhCDgFFCqr5aU7qYM6MCgYB9o36FvWjppnBQe59z0Pib 19 | x2Fjr05v2PqX8ykiYShrUk6MxnqpYfOc958dT7mCUNxA2ZbUFyOtU5i77raoS0CT 20 | 61Iir7eGKRqqtL+UW/nuABPWWSVdduink1ksjRS6eNFpb43Nd1cMdA2+vvazDiG7 21 | FV4zXZTn8tgOO/tU4F+T1QKBgDbP1bj2qCAsLJ6F+85hUHtfErftN+gL20OdZoL0 22 | QtTdlKkabz3LVrNRJWIlocQiGN+BYj3srmLuKxveZBtGk8O8ptyY/6mbs/szdEj6 23 | /QbtjU00W1EyG8g8nNYykPeUnwB5+Ez9WtfY0erHNJ7TbzfvEhzD3eT4TMETiBCy 24 | B9NlAoGBALmbExezIjpBqOep+1/My7oTWXnoPRyKZSD/4JynZKSBQBDesacD/UUv 25 | FoZyPUVqZKGKGI68TqLg+8nlx5nqbz9qBDekVF434cZ8OqiI4oiBtLkHGFoYHp0A 26 | Wf8sR9x0ZgDL02nVUwdyOBYk5+xrYW3+tLeWa81eC3nt1cThG3B3 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /testutils/public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvV4jSsNuxPBxLnhD+3g5 3 | 2U5fxP1NtGlcdpPaCgDe+jtGApTCmXCzEj/TcRqPmyFCC6OxN5RzUMm/UPyi3Umn 4 | PERX7r5tS9T5VO/0wcxN6HXQmNQJa5h6qT0/GGEQQDnopbEe0lpKKYyzHH3shtdZ 5 | paPbksp1fDUE+dSsg2OXqy+Zn/rAoB3eCDnYQhWOO4KLf7GDB0ty+OK/2GB6Zs0H 6 | 3gCRw4nYjpWWxSjv5Sq1lbL600lAhFWJC5+SdbnShxm6aXP0Kh4AR/icxBqc3mfC 7 | vzjYyE79odcLE6sjdKPAC+QiHYyyTjfmNZ6O0ObgcIRkMCq7mJ3A41Q+fv11Ktss 8 | PwIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /testutils/utils.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import ( 4 | "io/ioutil" 5 | 6 | log "github.com/Sirupsen/logrus" 7 | jwt "github.com/dgrijalva/jwt-go" 8 | ) 9 | 10 | func CreateTokenWithPayload(payload map[string]interface{}, privateKey interface{}) string { 11 | token := jwt.New(jwt.GetSigningMethod("RS256")) 12 | token.Claims = payload 13 | signed, err := token.SignedString(privateKey) 14 | if err != nil { 15 | log.Fatal("Failed to parse private key.", err) 16 | } 17 | return signed 18 | } 19 | 20 | func CreateToken(hostUUID string, privateKey interface{}) string { 21 | token := jwt.New(jwt.GetSigningMethod("RS256")) 22 | token.Claims["hostUuid"] = hostUUID 23 | signed, err := token.SignedString(privateKey) 24 | if err != nil { 25 | log.Fatal("Failed to parse private key.", err) 26 | } 27 | return signed 28 | } 29 | 30 | func CreateBackendToken(reportedUUID string, privateKey interface{}) string { 31 | token := jwt.New(jwt.GetSigningMethod("RS256")) 32 | token.Claims["reportedUuid"] = reportedUUID 33 | signed, err := token.SignedString(privateKey) 34 | if err != nil { 35 | log.Fatal("Failed to parse private key.", err) 36 | } 37 | return signed 38 | } 39 | 40 | func ParseTestPrivateKey() interface{} { 41 | keyBytes, err := ioutil.ReadFile("../testutils/private.pem") 42 | if err != nil { 43 | log.Fatal("Failed to parse private key.", err) 44 | } 45 | 46 | privateKey, err := jwt.ParseRSAPrivateKeyFromPEM(keyBytes) 47 | if err != nil { 48 | log.Fatal("Failed to parse private key.", err) 49 | } 50 | 51 | return privateKey 52 | } 53 | 54 | func ParseTestPublicKey() interface{} { 55 | keyBytes, err := ioutil.ReadFile("../testutils/public.pem") 56 | if err != nil { 57 | log.Fatal("Failed to parse public key.", err) 58 | } 59 | 60 | publicKey, err := jwt.ParseRSAPublicKeyFromPEM(keyBytes) 61 | if err != nil { 62 | log.Fatal("Failed to parse public key.", err) 63 | } 64 | 65 | return publicKey 66 | 67 | } 68 | -------------------------------------------------------------------------------- /tools/local-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | go build 4 | sudo cp websocket-proxy /usr/bin/ 5 | pkill -9 websocket-proxy 6 | -------------------------------------------------------------------------------- /tools/local-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | go clean; go build 4 | 5 | ./websocket-proxy -jwt-public-key-file="$CATTLE_HOME/api.crt" -listen-address="localhost:8080" -cattle-address="localhost:8081" 6 | -------------------------------------------------------------------------------- /trash.conf: -------------------------------------------------------------------------------- 1 | github.com/Sirupsen/logrus a283a10442df8dc09befd873fab202bf8a253d6a 2 | github.com/dgrijalva/jwt-go 2e53eb673c4450614e3bca6f345197f9527dce71 3 | github.com/docker/go-connections 3ede32e2033de7505e6500d6c868c2b9ed9f169d 4 | github.com/gorilla/context v1.1-4-gaed02d1 5 | github.com/gorilla/mux v1.1-20-g7804150 6 | github.com/gorilla/websocket 1551221275a7bd42978745a376b2531f791d88f3 7 | github.com/patrickmn/go-cache 1881a9bccb818787f68c52bfba648c6cf34c34fa 8 | github.com/pborman/uuid c55201b036063326c5b1b89ccfe45a184973d073 9 | github.com/rakyll/globalconf 415abc325023f1a00cd2d9fa512e0e71745791a2 10 | github.com/rakyll/goini 907cca0f578a5316fb864ec6992dc3d9730ec58c 11 | github.com/rancher/go-rancher a1c9bd6d7e42e2d42685763808336fd4df3b6077 12 | github.com/pkg/errors 248dadf4e9068a0b3e79f02ed0a610d935de5302 13 | gopkg.in/check.v1 4f90aeace3a26ad7021961c297b22c42160c7b25 14 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3 4 | - 1.4 5 | - 1.5 6 | - 1.6 7 | - tip 8 | install: 9 | - go get -t ./... 10 | script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./... 11 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.10.0 2 | 3 | * feature: Add a test hook (#180) 4 | * feature: `ParseLevel` is now case-insensitive (#326) 5 | * feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308) 6 | * performance: avoid re-allocations on `WithFields` (#335) 7 | 8 | # 0.9.0 9 | 10 | * logrus/text_formatter: don't emit empty msg 11 | * logrus/hooks/airbrake: move out of main repository 12 | * logrus/hooks/sentry: move out of main repository 13 | * logrus/hooks/papertrail: move out of main repository 14 | * logrus/hooks/bugsnag: move out of main repository 15 | * logrus/core: run tests with `-race` 16 | * logrus/core: detect TTY based on `stderr` 17 | * logrus/core: support `WithError` on logger 18 | * logrus/core: Solaris support 19 | 20 | # 0.8.7 21 | 22 | * logrus/core: fix possible race (#216) 23 | * logrus/doc: small typo fixes and doc improvements 24 | 25 | 26 | # 0.8.6 27 | 28 | * hooks/raven: allow passing an initialized client 29 | 30 | # 0.8.5 31 | 32 | * logrus/core: revert #208 33 | 34 | # 0.8.4 35 | 36 | * formatter/text: fix data race (#218) 37 | 38 | # 0.8.3 39 | 40 | * logrus/core: fix entry log level (#208) 41 | * logrus/core: improve performance of text formatter by 40% 42 | * logrus/core: expose `LevelHooks` type 43 | * logrus/core: add support for DragonflyBSD and NetBSD 44 | * formatter/text: print structs more verbosely 45 | 46 | # 0.8.2 47 | 48 | * logrus: fix more Fatal family functions 49 | 50 | # 0.8.1 51 | 52 | * logrus: fix not exiting on `Fatalf` and `Fatalln` 53 | 54 | # 0.8.0 55 | 56 | * logrus: defaults to stderr instead of stdout 57 | * hooks/sentry: add special field for `*http.Request` 58 | * formatter/text: ignore Windows for colors 59 | 60 | # 0.7.3 61 | 62 | * formatter/\*: allow configuration of timestamp layout 63 | 64 | # 0.7.2 65 | 66 | * formatter/text: Add configuration option for time format (#158) 67 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/alt_exit.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // The following code was sourced and modified from the 4 | // https://bitbucket.org/tebeka/atexit package governed by the following license: 5 | // 6 | // Copyright (c) 2012 Miki Tebeka . 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | // this software and associated documentation files (the "Software"), to deal in 10 | // the Software without restriction, including without limitation the rights to 11 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | // the Software, and to permit persons to whom the Software is furnished to do so, 13 | // subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | import ( 26 | "fmt" 27 | "os" 28 | ) 29 | 30 | var handlers = []func(){} 31 | 32 | func runHandler(handler func()) { 33 | defer func() { 34 | if err := recover(); err != nil { 35 | fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err) 36 | } 37 | }() 38 | 39 | handler() 40 | } 41 | 42 | func runHandlers() { 43 | for _, handler := range handlers { 44 | runHandler(handler) 45 | } 46 | } 47 | 48 | // Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code) 49 | func Exit(code int) { 50 | runHandlers() 51 | os.Exit(code) 52 | } 53 | 54 | // RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke 55 | // all handlers. The handlers will also be invoked when any Fatal log entry is 56 | // made. 57 | // 58 | // This method is useful when a caller wishes to use logrus to log a fatal 59 | // message but also needs to gracefully shutdown. An example usecase could be 60 | // closing database connections, or sending a alert that the application is 61 | // closing. 62 | func RegisterExitHandler(handler func()) { 63 | handlers = append(handlers, handler) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/Sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/Sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const DefaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields) { 34 | if t, ok := data["time"]; ok { 35 | data["fields.time"] = t 36 | } 37 | 38 | if m, ok := data["msg"]; ok { 39 | data["fields.msg"] = m 40 | } 41 | 42 | if l, ok := data["level"]; ok { 43 | data["fields.level"] = l 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type JSONFormatter struct { 9 | // TimestampFormat sets the format used for marshaling timestamps. 10 | TimestampFormat string 11 | } 12 | 13 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 14 | data := make(Fields, len(entry.Data)+3) 15 | for k, v := range entry.Data { 16 | switch v := v.(type) { 17 | case error: 18 | // Otherwise errors are ignored by `encoding/json` 19 | // https://github.com/Sirupsen/logrus/issues/137 20 | data[k] = v.Error() 21 | default: 22 | data[k] = v 23 | } 24 | } 25 | prefixFieldClashes(data) 26 | 27 | timestampFormat := f.TimestampFormat 28 | if timestampFormat == "" { 29 | timestampFormat = DefaultTimestampFormat 30 | } 31 | 32 | data["time"] = entry.Time.Format(timestampFormat) 33 | data["msg"] = entry.Message 34 | data["level"] = entry.Level.String() 35 | 36 | serialized, err := json.Marshal(data) 37 | if err != nil { 38 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 39 | } 40 | return append(serialized, '\n'), nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | package logrus 4 | 5 | import "syscall" 6 | 7 | const ioctlReadTermios = syscall.TIOCGETA 8 | 9 | type Termios syscall.Termios 10 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TCGETS 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux darwin freebsd openbsd netbsd dragonfly 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if stderr's file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stderr 18 | var termios Termios 19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 20 | return err == 0 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | 3 | package logrus 4 | 5 | import ( 6 | "os" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | // IsTerminal returns true if the given file descriptor is a terminal. 12 | func IsTerminal() bool { 13 | _, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA) 14 | return err == nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build windows 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTerminal returns true if stderr's file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stderr 24 | var st uint32 25 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0) 26 | return r != 0 && e == 0 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | return logger.WriterLevel(InfoLevel) 11 | } 12 | 13 | func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { 14 | reader, writer := io.Pipe() 15 | 16 | var printFunc func(args ...interface{}) 17 | switch level { 18 | case DebugLevel: 19 | printFunc = logger.Debug 20 | case InfoLevel: 21 | printFunc = logger.Info 22 | case WarnLevel: 23 | printFunc = logger.Warn 24 | case ErrorLevel: 25 | printFunc = logger.Error 26 | case FatalLevel: 27 | printFunc = logger.Fatal 28 | case PanicLevel: 29 | printFunc = logger.Panic 30 | default: 31 | printFunc = logger.Print 32 | } 33 | 34 | go logger.writerScanner(reader, printFunc) 35 | runtime.SetFinalizer(writer, writerFinalizer) 36 | 37 | return writer 38 | } 39 | 40 | func (logger *Logger) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 41 | scanner := bufio.NewScanner(reader) 42 | for scanner.Scan() { 43 | printFunc(scanner.Text()) 44 | } 45 | if err := scanner.Err(); err != nil { 46 | logger.Errorf("Error while reading from Writer: %s", err) 47 | } 48 | reader.Close() 49 | } 50 | 51 | func writerFinalizer(writer *io.PipeWriter) { 52 | writer.Close() 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | bin 3 | 4 | 5 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3.3 5 | - 1.4.2 6 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Dave Grijalva 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/doc.go: -------------------------------------------------------------------------------- 1 | // Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html 2 | // 3 | // See README.md for more info. 4 | package jwt 5 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/errors.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // Error constants 8 | var ( 9 | ErrInvalidKey = errors.New("key is invalid or of invalid type") 10 | ErrHashUnavailable = errors.New("the requested hash function is unavailable") 11 | ErrNoTokenInRequest = errors.New("no token present in request") 12 | ) 13 | 14 | // The errors that might occur when parsing and validating a token 15 | const ( 16 | ValidationErrorMalformed uint32 = 1 << iota // Token is malformed 17 | ValidationErrorUnverifiable // Token could not be verified because of signing problems 18 | ValidationErrorSignatureInvalid // Signature validation failed 19 | ValidationErrorExpired // Exp validation failed 20 | ValidationErrorNotValidYet // NBF validation failed 21 | ) 22 | 23 | // The error from Parse if token is not valid 24 | type ValidationError struct { 25 | err string 26 | Errors uint32 // bitfield. see ValidationError... constants 27 | } 28 | 29 | // Validation error is an error type 30 | func (e ValidationError) Error() string { 31 | if e.err == "" { 32 | return "token is invalid" 33 | } 34 | return e.err 35 | } 36 | 37 | // No errors 38 | func (e *ValidationError) valid() bool { 39 | if e.Errors > 0 { 40 | return false 41 | } 42 | return true 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/hmac.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "crypto" 5 | "crypto/hmac" 6 | "errors" 7 | ) 8 | 9 | // Implements the HMAC-SHA family of signing methods signing methods 10 | type SigningMethodHMAC struct { 11 | Name string 12 | Hash crypto.Hash 13 | } 14 | 15 | // Specific instances for HS256 and company 16 | var ( 17 | SigningMethodHS256 *SigningMethodHMAC 18 | SigningMethodHS384 *SigningMethodHMAC 19 | SigningMethodHS512 *SigningMethodHMAC 20 | ErrSignatureInvalid = errors.New("signature is invalid") 21 | ) 22 | 23 | func init() { 24 | // HS256 25 | SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} 26 | RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { 27 | return SigningMethodHS256 28 | }) 29 | 30 | // HS384 31 | SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} 32 | RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { 33 | return SigningMethodHS384 34 | }) 35 | 36 | // HS512 37 | SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} 38 | RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { 39 | return SigningMethodHS512 40 | }) 41 | } 42 | 43 | func (m *SigningMethodHMAC) Alg() string { 44 | return m.Name 45 | } 46 | 47 | func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error { 48 | if keyBytes, ok := key.([]byte); ok { 49 | var sig []byte 50 | var err error 51 | if sig, err = DecodeSegment(signature); err == nil { 52 | if !m.Hash.Available() { 53 | return ErrHashUnavailable 54 | } 55 | 56 | hasher := hmac.New(m.Hash.New, keyBytes) 57 | hasher.Write([]byte(signingString)) 58 | 59 | if !hmac.Equal(sig, hasher.Sum(nil)) { 60 | err = ErrSignatureInvalid 61 | } 62 | } 63 | return err 64 | } 65 | 66 | return ErrInvalidKey 67 | } 68 | 69 | // Implements the Sign method from SigningMethod for this signing method. 70 | // Key must be []byte 71 | func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) { 72 | if keyBytes, ok := key.([]byte); ok { 73 | if !m.Hash.Available() { 74 | return "", ErrHashUnavailable 75 | } 76 | 77 | hasher := hmac.New(m.Hash.New, keyBytes) 78 | hasher.Write([]byte(signingString)) 79 | 80 | return EncodeSegment(hasher.Sum(nil)), nil 81 | } 82 | 83 | return "", ErrInvalidKey 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/rsa_utils.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "crypto/rsa" 5 | "crypto/x509" 6 | "encoding/pem" 7 | "errors" 8 | ) 9 | 10 | var ( 11 | ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") 12 | ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") 13 | ) 14 | 15 | // Parse PEM encoded PKCS1 or PKCS8 private key 16 | func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { 17 | var err error 18 | 19 | // Parse PEM block 20 | var block *pem.Block 21 | if block, _ = pem.Decode(key); block == nil { 22 | return nil, ErrKeyMustBePEMEncoded 23 | } 24 | 25 | var parsedKey interface{} 26 | if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { 27 | if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { 28 | return nil, err 29 | } 30 | } 31 | 32 | var pkey *rsa.PrivateKey 33 | var ok bool 34 | if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { 35 | return nil, ErrNotRSAPrivateKey 36 | } 37 | 38 | return pkey, nil 39 | } 40 | 41 | // Parse PEM encoded PKCS1 or PKCS8 public key 42 | func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { 43 | var err error 44 | 45 | // Parse PEM block 46 | var block *pem.Block 47 | if block, _ = pem.Decode(key); block == nil { 48 | return nil, ErrKeyMustBePEMEncoded 49 | } 50 | 51 | // Parse the key 52 | var parsedKey interface{} 53 | if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { 54 | if cert, err := x509.ParseCertificate(block.Bytes); err == nil { 55 | parsedKey = cert.PublicKey 56 | } else { 57 | return nil, err 58 | } 59 | } 60 | 61 | var pkey *rsa.PublicKey 62 | var ok bool 63 | if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { 64 | return nil, ErrNotRSAPrivateKey 65 | } 66 | 67 | return pkey, nil 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/signing_method.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | var signingMethods = map[string]func() SigningMethod{} 4 | 5 | // Signing method 6 | type SigningMethod interface { 7 | Verify(signingString, signature string, key interface{}) error 8 | Sign(signingString string, key interface{}) (string, error) 9 | Alg() string 10 | } 11 | 12 | // Register the "alg" name and a factory function for signing method. 13 | // This is typically done during init() in the method's implementation 14 | func RegisterSigningMethod(alg string, f func() SigningMethod) { 15 | signingMethods[alg] = f 16 | } 17 | 18 | // Get a signing method from an "alg" string 19 | func GetSigningMethod(alg string) (method SigningMethod) { 20 | if methodF, ok := signingMethods[alg]; ok { 21 | method = methodF() 22 | } 23 | return 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Docker 2 | 3 | ### Sign your work 4 | 5 | The sign-off is a simple line at the end of the explanation for the patch. Your 6 | signature certifies that you wrote the patch or otherwise have the right to pass 7 | it on as an open-source patch. The rules are pretty simple: if you can certify 8 | the below (from [developercertificate.org](http://developercertificate.org/)): 9 | 10 | ``` 11 | Developer Certificate of Origin 12 | Version 1.1 13 | 14 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 15 | 660 York Street, Suite 102, 16 | San Francisco, CA 94110 USA 17 | 18 | Everyone is permitted to copy and distribute verbatim copies of this 19 | license document, but changing it is not allowed. 20 | 21 | Developer's Certificate of Origin 1.1 22 | 23 | By making a contribution to this project, I certify that: 24 | 25 | (a) The contribution was created in whole or in part by me and I 26 | have the right to submit it under the open source license 27 | indicated in the file; or 28 | 29 | (b) The contribution is based upon previous work that, to the best 30 | of my knowledge, is covered under an appropriate open source 31 | license and I have the right under that license to submit that 32 | work with modifications, whether created in whole or in part 33 | by me, under the same open source license (unless I am 34 | permitted to submit under a different license), as indicated 35 | in the file; or 36 | 37 | (c) The contribution was provided directly to me by some other 38 | person who certified (a), (b) or (c) and I have not modified 39 | it. 40 | 41 | (d) I understand and agree that this project and the contribution 42 | are public and that a record of the contribution (including all 43 | personal information I submit with it, including my sign-off) is 44 | maintained indefinitely and may be redistributed consistent with 45 | this project or the open source license(s) involved. 46 | ``` 47 | 48 | Then you just add a line to every git commit message: 49 | 50 | Signed-off-by: Joe Smith 51 | 52 | Use your real name (sorry, no pseudonyms or anonymous contributions.) 53 | 54 | If you set your `user.name` and `user.email` git configs, you can sign your 55 | commit automatically with `git commit -s`. 56 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/MAINTAINERS: -------------------------------------------------------------------------------- 1 | # go-connections maintainers file 2 | # 3 | # This file describes who runs the docker/go-connections project and how. 4 | # This is a living document - if you see something out of date or missing, speak up! 5 | # 6 | # It is structured to be consumable by both humans and programs. 7 | # To extract its contents programmatically, use any TOML-compliant parser. 8 | # 9 | # This file is compiled into the MAINTAINERS file in docker/opensource. 10 | # 11 | [Org] 12 | [Org."Core maintainers"] 13 | people = [ 14 | "calavera", 15 | ] 16 | 17 | [people] 18 | 19 | # A reference list of all people associated with the project. 20 | # All other sections should refer to people by their canonical key 21 | # in the people section. 22 | 23 | # ADD YOURSELF HERE IN ALPHABETICAL ORDER 24 | [people.calavera] 25 | Name = "David Calavera" 26 | Email = "david.calavera@gmail.com" 27 | GitHub = "calavera" 28 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/README.md: -------------------------------------------------------------------------------- 1 | [![GoDoc](https://godoc.org/github.com/docker/go-connections?status.svg)](https://godoc.org/github.com/docker/go-connections) 2 | 3 | # Introduction 4 | 5 | go-connections provides common package to work with network connections. 6 | 7 | ## Usage 8 | 9 | See the [docs in godoc](https://godoc.org/github.com/docker/go-connections) for examples and documentation. 10 | 11 | ## License 12 | 13 | go-connections is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full license text. 14 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/circle.yml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | pre: 3 | # setup ipv6 4 | - sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0 net.ipv6.conf.all.disable_ipv6=0 5 | post: 6 | # install golint 7 | - go get github.com/golang/lint/golint 8 | 9 | test: 10 | pre: 11 | # run analysis before tests 12 | - go vet ./... 13 | - test -z "$(golint ./... | tee /dev/stderr)" 14 | - test -z "$(gofmt -s -l . | tee /dev/stderr)" 15 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/certpool_go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package tlsconfig 4 | 5 | import ( 6 | "crypto/x509" 7 | "runtime" 8 | ) 9 | 10 | // SystemCertPool returns a copy of the system cert pool, 11 | // returns an error if failed to load or empty pool on windows. 12 | func SystemCertPool() (*x509.CertPool, error) { 13 | certpool, err := x509.SystemCertPool() 14 | if err != nil && runtime.GOOS == "windows" { 15 | return x509.NewCertPool(), nil 16 | } 17 | return certpool, err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/certpool_other.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package tlsconfig 4 | 5 | import ( 6 | "crypto/x509" 7 | 8 | ) 9 | 10 | // SystemCertPool returns an new empty cert pool, 11 | // accessing system cert pool is supported in go 1.7 12 | func SystemCertPool() (*x509.CertPool, error) { 13 | return x509.NewCertPool(), nil 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/config_client_ciphers.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | // Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. 4 | // 5 | package tlsconfig 6 | 7 | import ( 8 | "crypto/tls" 9 | ) 10 | 11 | // Client TLS cipher suites (dropping CBC ciphers for client preferred suite set) 12 | var clientCipherSuites = []uint16{ 13 | tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 14 | tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 15 | tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16 | tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/docker/go-connections/tlsconfig/config_legacy_client_ciphers.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | // Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. 4 | // 5 | package tlsconfig 6 | 7 | import ( 8 | "crypto/tls" 9 | ) 10 | 11 | // Client TLS cipher suites (dropping CBC ciphers for client preferred suite set) 12 | var clientCipherSuites = []uint16{ 13 | tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 14 | tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.3 7 | - go: 1.4 8 | - go: 1.5 9 | - go: 1.6 10 | - go: tip 11 | allow_failures: 12 | - go: tip 13 | 14 | script: 15 | - go get -t -v ./... 16 | - diff -u <(echo -n) <(gofmt -d .) 17 | - go vet $(go list ./... | grep -v /vendor/) 18 | - go test -v -race ./... 19 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rodrigo Moraes. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/README.md: -------------------------------------------------------------------------------- 1 | context 2 | ======= 3 | [![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) 4 | 5 | gorilla/context is a general purpose registry for global request variables. 6 | 7 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/context 8 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Gorilla Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package context stores values shared during a request lifetime. 7 | 8 | For example, a router can set variables extracted from the URL and later 9 | application handlers can access those values, or it can be used to store 10 | sessions values to be saved at the end of a request. There are several 11 | others common uses. 12 | 13 | The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: 14 | 15 | http://groups.google.com/group/golang-nuts/msg/e2d679d303aa5d53 16 | 17 | Here's the basic usage: first define the keys that you will need. The key 18 | type is interface{} so a key can be of any type that supports equality. 19 | Here we define a key using a custom int type to avoid name collisions: 20 | 21 | package foo 22 | 23 | import ( 24 | "github.com/gorilla/context" 25 | ) 26 | 27 | type key int 28 | 29 | const MyKey key = 0 30 | 31 | Then set a variable. Variables are bound to an http.Request object, so you 32 | need a request instance to set a value: 33 | 34 | context.Set(r, MyKey, "bar") 35 | 36 | The application can later access the variable using the same key you provided: 37 | 38 | func MyHandler(w http.ResponseWriter, r *http.Request) { 39 | // val is "bar". 40 | val := context.Get(r, foo.MyKey) 41 | 42 | // returns ("bar", true) 43 | val, ok := context.GetOk(r, foo.MyKey) 44 | // ... 45 | } 46 | 47 | And that's all about the basic usage. We discuss some other ideas below. 48 | 49 | Any type can be stored in the context. To enforce a given type, make the key 50 | private and wrap Get() and Set() to accept and return values of a specific 51 | type: 52 | 53 | type key int 54 | 55 | const mykey key = 0 56 | 57 | // GetMyKey returns a value for this package from the request values. 58 | func GetMyKey(r *http.Request) SomeType { 59 | if rv := context.Get(r, mykey); rv != nil { 60 | return rv.(SomeType) 61 | } 62 | return nil 63 | } 64 | 65 | // SetMyKey sets a value for this package in the request values. 66 | func SetMyKey(r *http.Request, val SomeType) { 67 | context.Set(r, mykey, val) 68 | } 69 | 70 | Variables must be cleared at the end of a request, to remove all values 71 | that were stored. This can be done in an http.Handler, after a request was 72 | served. Just call Clear() passing the request: 73 | 74 | context.Clear(r) 75 | 76 | ...or use ClearHandler(), which conveniently wraps an http.Handler to clear 77 | variables at the end of a request lifetime. 78 | 79 | The Routers from the packages gorilla/mux and gorilla/pat call Clear() 80 | so if you are using either of them you don't need to clear the context manually. 81 | */ 82 | package context 83 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.2 7 | - go: 1.3 8 | - go: 1.4 9 | - go: 1.5 10 | - go: 1.6 11 | - go: tip 12 | 13 | install: 14 | - # Skip 15 | 16 | script: 17 | - go get -t -v ./... 18 | - diff -u <(echo -n) <(gofmt -d .) 19 | - go tool vet . 20 | - go test -v -race ./... 21 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rodrigo Moraes. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_gorilla.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/gorilla/context" 9 | ) 10 | 11 | func contextGet(r *http.Request, key interface{}) interface{} { 12 | return context.Get(r, key) 13 | } 14 | 15 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 16 | if val == nil { 17 | return r 18 | } 19 | 20 | context.Set(r, key, val) 21 | return r 22 | } 23 | 24 | func contextClear(r *http.Request) { 25 | context.Clear(r) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_native.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "context" 7 | "net/http" 8 | ) 9 | 10 | func contextGet(r *http.Request, key interface{}) interface{} { 11 | return r.Context().Value(key) 12 | } 13 | 14 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 15 | if val == nil { 16 | return r 17 | } 18 | 19 | return r.WithContext(context.WithValue(r.Context(), key, val)) 20 | } 21 | 22 | func contextClear(r *http.Request) { 23 | return 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/websocket/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/websocket/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.1 5 | - 1.2 6 | - tip 7 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/websocket/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Gorilla WebSocket authors for copyright 2 | # purposes. 3 | # 4 | # Please keep the list sorted. 5 | 6 | Gary Burd 7 | Joachim Bauch 8 | 9 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/websocket/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/websocket/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "encoding/json" 9 | "io" 10 | ) 11 | 12 | // WriteJSON is deprecated, use c.WriteJSON instead. 13 | func WriteJSON(c *Conn, v interface{}) error { 14 | return c.WriteJSON(v) 15 | } 16 | 17 | // WriteJSON writes the JSON encoding of v to the connection. 18 | // 19 | // See the documentation for encoding/json Marshal for details about the 20 | // conversion of Go values to JSON. 21 | func (c *Conn) WriteJSON(v interface{}) error { 22 | w, err := c.NextWriter(TextMessage) 23 | if err != nil { 24 | return err 25 | } 26 | err1 := json.NewEncoder(w).Encode(v) 27 | err2 := w.Close() 28 | if err1 != nil { 29 | return err1 30 | } 31 | return err2 32 | } 33 | 34 | // ReadJSON is deprecated, use c.ReadJSON instead. 35 | func ReadJSON(c *Conn, v interface{}) error { 36 | return c.ReadJSON(v) 37 | } 38 | 39 | // ReadJSON reads the next JSON-encoded message from the connection and stores 40 | // it in the value pointed to by v. 41 | // 42 | // See the documentation for the encoding/json Unmarshal function for details 43 | // about the conversion of JSON to a Go value. 44 | func (c *Conn) ReadJSON(v interface{}) error { 45 | _, r, err := c.NextReader() 46 | if err != nil { 47 | return err 48 | } 49 | err = json.NewDecoder(r).Decode(v) 50 | if err == io.EOF { 51 | // Decode returns io.EOF when the message is empty or all whitespace. 52 | // Convert to io.ErrUnexpectedEOF so that application can distinguish 53 | // between an error reading the JSON value and the connection closing. 54 | err = io.ErrUnexpectedEOF 55 | } 56 | return err 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/websocket/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "crypto/rand" 9 | "crypto/sha1" 10 | "encoding/base64" 11 | "io" 12 | "net/http" 13 | "strings" 14 | ) 15 | 16 | // tokenListContainsValue returns true if the 1#token header with the given 17 | // name contains token. 18 | func tokenListContainsValue(header http.Header, name string, value string) bool { 19 | for _, v := range header[name] { 20 | for _, s := range strings.Split(v, ",") { 21 | if strings.EqualFold(value, strings.TrimSpace(s)) { 22 | return true 23 | } 24 | } 25 | } 26 | return false 27 | } 28 | 29 | var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") 30 | 31 | func computeAcceptKey(challengeKey string) string { 32 | h := sha1.New() 33 | h.Write([]byte(challengeKey)) 34 | h.Write(keyGUID) 35 | return base64.StdEncoding.EncodeToString(h.Sum(nil)) 36 | } 37 | 38 | func generateChallengeKey() (string, error) { 39 | p := make([]byte, 16) 40 | if _, err := io.ReadFull(rand.Reader, p); err != nil { 41 | return "", err 42 | } 43 | return base64.StdEncoding.EncodeToString(p), nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/patrickmn/go-cache/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | This is a list of people who have contributed code to go-cache. They, or their 2 | employers, are the copyright holders of the contributed code. Contributed code 3 | is subject to the license restrictions listed in LICENSE (as they were when the 4 | code was contributed.) 5 | 6 | Dustin Sallings 7 | Jason Mooberry 8 | Sergey Shepelev 9 | -------------------------------------------------------------------------------- /vendor/github.com/patrickmn/go-cache/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2015 Patrick Mylund Nielsen and the go-cache contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.3 5 | - 1.5.3 6 | - release 7 | - tip 8 | 9 | script: 10 | - go test -v ./... 11 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to this project! 4 | 5 | ### Legal requirements 6 | 7 | In order to protect both you and ourselves, you will need to sign the 8 | [Contributor License Agreement](https://cla.developers.google.com/clas). 9 | 10 | You may have already signed it for other Google projects. 11 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009,2014 Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/README.md: -------------------------------------------------------------------------------- 1 | This project was automatically exported from code.google.com/p/go-uuid 2 | 3 | # uuid ![build status](https://travis-ci.org/pborman/uuid.svg?branch=master) 4 | The uuid package generates and inspects UUIDs based on [RFC 412](http://tools.ietf.org/html/rfc4122) and DCE 1.1: Authentication and Security Services. 5 | 6 | ###### Install 7 | `go get github.com/pborman/uuid` 8 | 9 | ###### Documentation 10 | [![GoDoc](https://godoc.org/github.com/pborman/uuid?status.svg)](http://godoc.org/github.com/pborman/uuid) 11 | 12 | Full `go doc` style documentation for the package can be viewed online without installing this package by using the GoDoc site here: 13 | http://godoc.org/github.com/pborman/uuid 14 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/dce.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | "fmt" 10 | "os" 11 | ) 12 | 13 | // A Domain represents a Version 2 domain 14 | type Domain byte 15 | 16 | // Domain constants for DCE Security (Version 2) UUIDs. 17 | const ( 18 | Person = Domain(0) 19 | Group = Domain(1) 20 | Org = Domain(2) 21 | ) 22 | 23 | // NewDCESecurity returns a DCE Security (Version 2) UUID. 24 | // 25 | // The domain should be one of Person, Group or Org. 26 | // On a POSIX system the id should be the users UID for the Person 27 | // domain and the users GID for the Group. The meaning of id for 28 | // the domain Org or on non-POSIX systems is site defined. 29 | // 30 | // For a given domain/id pair the same token may be returned for up to 31 | // 7 minutes and 10 seconds. 32 | func NewDCESecurity(domain Domain, id uint32) UUID { 33 | uuid := NewUUID() 34 | if uuid != nil { 35 | uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 36 | uuid[9] = byte(domain) 37 | binary.BigEndian.PutUint32(uuid[0:], id) 38 | } 39 | return uuid 40 | } 41 | 42 | // NewDCEPerson returns a DCE Security (Version 2) UUID in the person 43 | // domain with the id returned by os.Getuid. 44 | // 45 | // NewDCEPerson(Person, uint32(os.Getuid())) 46 | func NewDCEPerson() UUID { 47 | return NewDCESecurity(Person, uint32(os.Getuid())) 48 | } 49 | 50 | // NewDCEGroup returns a DCE Security (Version 2) UUID in the group 51 | // domain with the id returned by os.Getgid. 52 | // 53 | // NewDCEGroup(Group, uint32(os.Getgid())) 54 | func NewDCEGroup() UUID { 55 | return NewDCESecurity(Group, uint32(os.Getgid())) 56 | } 57 | 58 | // Domain returns the domain for a Version 2 UUID or false. 59 | func (uuid UUID) Domain() (Domain, bool) { 60 | if v, _ := uuid.Version(); v != 2 { 61 | return 0, false 62 | } 63 | return Domain(uuid[9]), true 64 | } 65 | 66 | // Id returns the id for a Version 2 UUID or false. 67 | func (uuid UUID) Id() (uint32, bool) { 68 | if v, _ := uuid.Version(); v != 2 { 69 | return 0, false 70 | } 71 | return binary.BigEndian.Uint32(uuid[0:4]), true 72 | } 73 | 74 | func (d Domain) String() string { 75 | switch d { 76 | case Person: 77 | return "Person" 78 | case Group: 79 | return "Group" 80 | case Org: 81 | return "Org" 82 | } 83 | return fmt.Sprintf("Domain%d", int(d)) 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The uuid package generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services. 8 | package uuid 9 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "crypto/md5" 9 | "crypto/sha1" 10 | "hash" 11 | ) 12 | 13 | // Well known Name Space IDs and UUIDs 14 | var ( 15 | NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") 16 | NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8") 17 | NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8") 18 | NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8") 19 | NIL = Parse("00000000-0000-0000-0000-000000000000") 20 | ) 21 | 22 | // NewHash returns a new UUID derived from the hash of space concatenated with 23 | // data generated by h. The hash should be at least 16 byte in length. The 24 | // first 16 bytes of the hash are used to form the UUID. The version of the 25 | // UUID will be the lower 4 bits of version. NewHash is used to implement 26 | // NewMD5 and NewSHA1. 27 | func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { 28 | h.Reset() 29 | h.Write(space) 30 | h.Write([]byte(data)) 31 | s := h.Sum(nil) 32 | uuid := make([]byte, 16) 33 | copy(uuid, s) 34 | uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) 35 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant 36 | return uuid 37 | } 38 | 39 | // NewMD5 returns a new MD5 (Version 3) UUID based on the 40 | // supplied name space and data. 41 | // 42 | // NewHash(md5.New(), space, data, 3) 43 | func NewMD5(space UUID, data []byte) UUID { 44 | return NewHash(md5.New(), space, data, 3) 45 | } 46 | 47 | // NewSHA1 returns a new SHA1 (Version 5) UUID based on the 48 | // supplied name space and data. 49 | // 50 | // NewHash(sha1.New(), space, data, 5) 51 | func NewSHA1(space UUID, data []byte) UUID { 52 | return NewHash(sha1.New(), space, data, 5) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import "errors" 8 | 9 | func (u UUID) MarshalJSON() ([]byte, error) { 10 | if len(u) != 16 { 11 | return []byte(`""`), nil 12 | } 13 | var js [38]byte 14 | js[0] = '"' 15 | encodeHex(js[1:], u) 16 | js[37] = '"' 17 | return js[:], nil 18 | } 19 | 20 | func (u *UUID) UnmarshalJSON(data []byte) error { 21 | if string(data) == `""` { 22 | return nil 23 | } 24 | if data[0] != '"' { 25 | return errors.New("invalid UUID format") 26 | } 27 | data = data[1 : len(data)-1] 28 | uu := Parse(string(data)) 29 | if uu == nil { 30 | return errors.New("invalid UUID format") 31 | } 32 | *u = uu 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/sql.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "database/sql/driver" 9 | "errors" 10 | "fmt" 11 | ) 12 | 13 | // Scan implements sql.Scanner so UUIDs can be read from databases transparently 14 | // Currently, database types that map to string and []byte are supported. Please 15 | // consult database-specific driver documentation for matching types. 16 | func (uuid *UUID) Scan(src interface{}) error { 17 | switch src.(type) { 18 | case string: 19 | // if an empty UUID comes from a table, we return a null UUID 20 | if src.(string) == "" { 21 | return nil 22 | } 23 | 24 | // see uuid.Parse for required string format 25 | parsed := Parse(src.(string)) 26 | 27 | if parsed == nil { 28 | return errors.New("Scan: invalid UUID format") 29 | } 30 | 31 | *uuid = parsed 32 | case []byte: 33 | b := src.([]byte) 34 | 35 | // if an empty UUID comes from a table, we return a null UUID 36 | if len(b) == 0 { 37 | return nil 38 | } 39 | 40 | // assumes a simple slice of bytes if 16 bytes 41 | // otherwise attempts to parse 42 | if len(b) == 16 { 43 | *uuid = UUID(b) 44 | } else { 45 | u := Parse(string(b)) 46 | 47 | if u == nil { 48 | return errors.New("Scan: invalid UUID format") 49 | } 50 | 51 | *uuid = u 52 | } 53 | 54 | default: 55 | return fmt.Errorf("Scan: unable to scan type %T into UUID", src) 56 | } 57 | 58 | return nil 59 | } 60 | 61 | // Value implements sql.Valuer so that UUIDs can be written to databases 62 | // transparently. Currently, UUIDs map to strings. Please consult 63 | // database-specific driver documentation for matching types. 64 | func (uuid UUID) Value() (driver.Value, error) { 65 | return uuid.String(), nil 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | // randomBits completely fills slice b with random data. 12 | func randomBits(b []byte) { 13 | if _, err := io.ReadFull(rander, b); err != nil { 14 | panic(err.Error()) // rand should never fail 15 | } 16 | } 17 | 18 | // xvalues returns the value of a byte as a hexadecimal digit or 255. 19 | var xvalues = [256]byte{ 20 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 21 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 24 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 26 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 27 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 28 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 30 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 33 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 34 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 36 | } 37 | 38 | // xtob converts the the first two hex bytes of x into a byte. 39 | func xtob(x string) (byte, bool) { 40 | b1 := xvalues[x[0]] 41 | b2 := xvalues[x[1]] 42 | return (b1 << 4) | b2, b1 != 255 && b2 != 255 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/version1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | ) 10 | 11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock 12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID 13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot 14 | // be set NewUUID returns nil. If clock sequence has not been set by 15 | // SetClockSequence then it will be set automatically. If GetTime fails to 16 | // return the current NewUUID returns nil. 17 | func NewUUID() UUID { 18 | if nodeID == nil { 19 | SetNodeInterface("") 20 | } 21 | 22 | now, seq, err := GetTime() 23 | if err != nil { 24 | return nil 25 | } 26 | 27 | uuid := make([]byte, 16) 28 | 29 | time_low := uint32(now & 0xffffffff) 30 | time_mid := uint16((now >> 32) & 0xffff) 31 | time_hi := uint16((now >> 48) & 0x0fff) 32 | time_hi |= 0x1000 // Version 1 33 | 34 | binary.BigEndian.PutUint32(uuid[0:], time_low) 35 | binary.BigEndian.PutUint16(uuid[4:], time_mid) 36 | binary.BigEndian.PutUint16(uuid[6:], time_hi) 37 | binary.BigEndian.PutUint16(uuid[8:], seq) 38 | copy(uuid[10:], nodeID) 39 | 40 | return uuid 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/version4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | // Random returns a Random (Version 4) UUID or panics. 8 | // 9 | // The strength of the UUIDs is based on the strength of the crypto/rand 10 | // package. 11 | // 12 | // A note about uniqueness derived from from the UUID Wikipedia entry: 13 | // 14 | // Randomly generated UUIDs have 122 random bits. One's annual risk of being 15 | // hit by a meteorite is estimated to be one chance in 17 billion, that 16 | // means the probability is about 0.00000000006 (6 × 10−11), 17 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a 18 | // year and having one duplicate. 19 | func NewRandom() UUID { 20 | uuid := make([]byte, 16) 21 | randomBits([]byte(uuid)) 22 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 23 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 24 | return uuid 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.3 5 | - 1.5.4 6 | - 1.6.3 7 | - 1.7.3 8 | - tip 9 | 10 | script: 11 | - go test -v ./... 12 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/README.md: -------------------------------------------------------------------------------- 1 | # errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) 2 | 3 | Package errors provides simple error handling primitives. 4 | 5 | `go get github.com/pkg/errors` 6 | 7 | The traditional error handling idiom in Go is roughly akin to 8 | ```go 9 | if err != nil { 10 | return err 11 | } 12 | ``` 13 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. 14 | 15 | ## Adding context to an error 16 | 17 | The errors.Wrap function returns a new error that adds context to the original error. For example 18 | ```go 19 | _, err := ioutil.ReadAll(r) 20 | if err != nil { 21 | return errors.Wrap(err, "read failed") 22 | } 23 | ``` 24 | ## Retrieving the cause of an error 25 | 26 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. 27 | ```go 28 | type causer interface { 29 | Cause() error 30 | } 31 | ``` 32 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: 33 | ```go 34 | switch err := errors.Cause(err).(type) { 35 | case *MyError: 36 | // handle specifically 37 | default: 38 | // unknown error 39 | } 40 | ``` 41 | 42 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). 43 | 44 | ## Contributing 45 | 46 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. 47 | 48 | Before proposing a change, please discuss your change by raising an issue. 49 | 50 | ## Licence 51 | 52 | BSD-2-Clause 53 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/rakyll/globalconf/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 1.2 3 | -------------------------------------------------------------------------------- /vendor/github.com/rakyll/goini/.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | 3 | *.[689] 4 | [689].out 5 | 6 | _obj 7 | _test 8 | _testmain.go 9 | -------------------------------------------------------------------------------- /vendor/github.com/rakyll/goini/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | go test 3 | 4 | format: 5 | gofmt -w *.go 6 | 7 | .PHONY: format test 8 | -------------------------------------------------------------------------------- /vendor/github.com/rakyll/goini/empty.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rancher/websocket-proxy/34dabeb38f1ecb24e9c4f4c82f5ba8fe60f6d8f3/vendor/github.com/rakyll/goini/empty.ini -------------------------------------------------------------------------------- /vendor/github.com/rakyll/goini/example.ini: -------------------------------------------------------------------------------- 1 | # 2 | # This is an example of ini file 3 | # 4 | 5 | [Pizza] 6 | 7 | Ham = yes; 8 | Mushrooms = TRUE; 9 | Capres = 0; 10 | Cheese = Non; 11 | 12 | 13 | [Wine] 14 | 15 | Grape = Cabernet Sauvignon; 16 | Year = 1989; 17 | Country = Spain; 18 | Alcohol = 12.5; 19 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/.dockerignore: -------------------------------------------------------------------------------- 1 | ./bin 2 | ./.dapper 3 | ./dist 4 | ./.trash-cache 5 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/.drone.yml: -------------------------------------------------------------------------------- 1 | pipeline: 2 | build: 3 | image: rancher/dapper:1.10.3 4 | volumes: 5 | - /var/run/docker.sock:/var/run/docker.sock 6 | commands: 7 | - dapper ci 8 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/.gitignore: -------------------------------------------------------------------------------- 1 | /.dapper 2 | /bin 3 | /dist 4 | *.swp 5 | /.trash-cache 6 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/Dockerfile.dapper: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | # FROM arm=armhf/ubuntu:16.04 3 | 4 | ARG DAPPER_HOST_ARCH=amd64 5 | ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} 6 | 7 | RUN apt-get update && \ 8 | apt-get install -y gcc ca-certificates git wget curl vim less file && \ 9 | rm -f /bin/sh && ln -s /bin/bash /bin/sh 10 | 11 | ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH=GOLANG_ARCH_${ARCH} \ 12 | GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash 13 | 14 | ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \ 15 | DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \ 16 | DOCKER_URL=DOCKER_URL_${ARCH} 17 | RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker 18 | 19 | RUN wget -O - https://storage.googleapis.com/golang/go1.7.1.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \ 20 | go get github.com/rancher/trash && go get github.com/golang/lint/golint 21 | 22 | ENV DAPPER_SOURCE /go/src/github.com/rancher/go-rancher/ 23 | ENV DAPPER_OUTPUT ./bin 24 | ENV DAPPER_DOCKER_SOCKET true 25 | ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache 26 | ENV HOME ${DAPPER_SOURCE} 27 | WORKDIR ${DAPPER_SOURCE} 28 | 29 | ENTRYPOINT ["./scripts/entry"] 30 | CMD ["ci"] 31 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS := $(shell ls scripts) 2 | 3 | .dapper: 4 | @echo Downloading dapper 5 | @curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp 6 | @@chmod +x .dapper.tmp 7 | @./.dapper.tmp -v 8 | @mv .dapper.tmp .dapper 9 | 10 | $(TARGETS): .dapper 11 | ./.dapper $@ 12 | 13 | trash: .dapper 14 | ./.dapper -m bind trash 15 | 16 | trash-keep: .dapper 17 | ./.dapper -m bind trash -k 18 | 19 | deps: trash 20 | 21 | .DEFAULT_GOAL := ci 22 | 23 | .PHONY: $(TARGETS) 24 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/README.md: -------------------------------------------------------------------------------- 1 | # Go Bindings for Rancher API 2 | 3 | # Generating Code 4 | First, you must have a master version of Rancher running. The best way to do this is: 5 | ```sh 6 | docker run -p 8080:8080 -d rancher/server:master 7 | ``` 8 | 9 | Once Rancher is running, you can run the gen-schema.sh script: 10 | ```sh 11 | ./scripts/gen-schema.sh http://:8080 12 | 13 | # The default url is http://localhost:8080, so if rancher/server is listening on localhost, you can omit the url: 14 | ./scripts/gen-schema.sh 15 | ``` 16 | 17 | This will add, remove, and modify go files appropriately. Submit a PR that includes *all* these changes. 18 | 19 | ## Important caveats 20 | 1. If you are running on macOS, you must have gnu-sed installed as sed for this to work properly. 21 | 2. If you are running against cattle that is running out of an IDE and you don't have go-machine-service running (you probably don't), you'll see a number of unexpected removed or modified files like `generated_host.go` `generated_machine.go` and `generated_*config.go`. 22 | 23 | # Building 24 | 25 | ```sh 26 | godep go build ./client 27 | ``` 28 | 29 | # Tests 30 | 31 | ```sh 32 | godep go test ./client 33 | ``` 34 | # Contact 35 | For bugs, questions, comments, corrections, suggestions, etc., open an issue in 36 | [rancher/rancher](//github.com/rancher/rancher/issues) with a title starting with `[go-rancher] `. 37 | 38 | Or just [click here](//github.com/rancher/rancher/issues/new?title=%5Bgo-rancher%5D%20) to create a new issue. 39 | 40 | 41 | # License 42 | Copyright (c) 2014-2015 [Rancher Labs, Inc.](http://rancher.com) 43 | 44 | Licensed under the Apache License, Version 2.0 (the "License"); 45 | you may not use this file except in compliance with the License. 46 | You may obtain a copy of the License at 47 | 48 | [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 49 | 50 | Unless required by applicable law or agreed to in writing, software 51 | distributed under the License is distributed on an "AS IS" BASIS, 52 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 | See the License for the specific language governing permissions and 54 | limitations under the License. 55 | 56 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/trash.conf: -------------------------------------------------------------------------------- 1 | github.com/pkg/errors 1d2e60385a13aaa66134984235061c2f9302520e 2 | github.com/gorilla/context 215affda49addc4c8ef7e2534915df2c8c35c6cd 3 | github.com/gorilla/mux f15e0c49460fd49eebe2bcc8486b05d1bef68d3a 4 | github.com/gorilla/websocket 1551221275a7bd42978745a376b2531f791d88f3 5 | github.com/Sirupsen/logrus 26709e2714106fb8ad40b773b711ebce25b78914 6 | gopkg.in/yaml.v2 a83829b6f1293c91addabc89d0571c246397bbf4 7 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/client.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/gorilla/websocket" 7 | ) 8 | 9 | type RancherBaseClientImpl struct { 10 | Opts *ClientOpts 11 | Schemas *Schemas 12 | Types map[string]Schema 13 | } 14 | 15 | type RancherBaseClient interface { 16 | Websocket(string, map[string][]string) (*websocket.Conn, *http.Response, error) 17 | List(string, *ListOpts, interface{}) error 18 | Post(string, interface{}, interface{}) error 19 | GetLink(Resource, string, interface{}) error 20 | Create(string, interface{}, interface{}) error 21 | Update(string, *Resource, interface{}, interface{}) error 22 | ById(string, string, interface{}) error 23 | Delete(*Resource) error 24 | Reload(*Resource, interface{}) error 25 | Action(string, string, *Resource, interface{}, interface{}) error 26 | GetOpts() *ClientOpts 27 | GetSchemas() *Schemas 28 | GetTypes() map[string]Schema 29 | 30 | doGet(string, *ListOpts, interface{}) error 31 | doList(string, *ListOpts, interface{}) error 32 | doNext(string, interface{}) error 33 | doModify(string, string, interface{}, interface{}) error 34 | doCreate(string, interface{}, interface{}) error 35 | doUpdate(string, *Resource, interface{}, interface{}) error 36 | doById(string, string, interface{}) error 37 | doResourceDelete(string, *Resource) error 38 | doAction(string, string, *Resource, interface{}, interface{}) error 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_add_outputs_input.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | ADD_OUTPUTS_INPUT_TYPE = "addOutputsInput" 5 | ) 6 | 7 | type AddOutputsInput struct { 8 | Resource 9 | 10 | Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"` 11 | } 12 | 13 | type AddOutputsInputCollection struct { 14 | Collection 15 | Data []AddOutputsInput `json:"data,omitempty"` 16 | client *AddOutputsInputClient 17 | } 18 | 19 | type AddOutputsInputClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type AddOutputsInputOperations interface { 24 | List(opts *ListOpts) (*AddOutputsInputCollection, error) 25 | Create(opts *AddOutputsInput) (*AddOutputsInput, error) 26 | Update(existing *AddOutputsInput, updates interface{}) (*AddOutputsInput, error) 27 | ById(id string) (*AddOutputsInput, error) 28 | Delete(container *AddOutputsInput) error 29 | } 30 | 31 | func newAddOutputsInputClient(rancherClient *RancherClient) *AddOutputsInputClient { 32 | return &AddOutputsInputClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *AddOutputsInputClient) Create(container *AddOutputsInput) (*AddOutputsInput, error) { 38 | resp := &AddOutputsInput{} 39 | err := c.rancherClient.doCreate(ADD_OUTPUTS_INPUT_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *AddOutputsInputClient) Update(existing *AddOutputsInput, updates interface{}) (*AddOutputsInput, error) { 44 | resp := &AddOutputsInput{} 45 | err := c.rancherClient.doUpdate(ADD_OUTPUTS_INPUT_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *AddOutputsInputClient) List(opts *ListOpts) (*AddOutputsInputCollection, error) { 50 | resp := &AddOutputsInputCollection{} 51 | err := c.rancherClient.doList(ADD_OUTPUTS_INPUT_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *AddOutputsInputCollection) Next() (*AddOutputsInputCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &AddOutputsInputCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *AddOutputsInputClient) ById(id string) (*AddOutputsInput, error) { 67 | resp := &AddOutputsInput{} 68 | err := c.rancherClient.doById(ADD_OUTPUTS_INPUT_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *AddOutputsInputClient) Delete(container *AddOutputsInput) error { 78 | return c.rancherClient.doResourceDelete(ADD_OUTPUTS_INPUT_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_base_machine_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | BASE_MACHINE_CONFIG_TYPE = "baseMachineConfig" 5 | ) 6 | 7 | type BaseMachineConfig struct { 8 | Resource 9 | } 10 | 11 | type BaseMachineConfigCollection struct { 12 | Collection 13 | Data []BaseMachineConfig `json:"data,omitempty"` 14 | client *BaseMachineConfigClient 15 | } 16 | 17 | type BaseMachineConfigClient struct { 18 | rancherClient *RancherClient 19 | } 20 | 21 | type BaseMachineConfigOperations interface { 22 | List(opts *ListOpts) (*BaseMachineConfigCollection, error) 23 | Create(opts *BaseMachineConfig) (*BaseMachineConfig, error) 24 | Update(existing *BaseMachineConfig, updates interface{}) (*BaseMachineConfig, error) 25 | ById(id string) (*BaseMachineConfig, error) 26 | Delete(container *BaseMachineConfig) error 27 | } 28 | 29 | func newBaseMachineConfigClient(rancherClient *RancherClient) *BaseMachineConfigClient { 30 | return &BaseMachineConfigClient{ 31 | rancherClient: rancherClient, 32 | } 33 | } 34 | 35 | func (c *BaseMachineConfigClient) Create(container *BaseMachineConfig) (*BaseMachineConfig, error) { 36 | resp := &BaseMachineConfig{} 37 | err := c.rancherClient.doCreate(BASE_MACHINE_CONFIG_TYPE, container, resp) 38 | return resp, err 39 | } 40 | 41 | func (c *BaseMachineConfigClient) Update(existing *BaseMachineConfig, updates interface{}) (*BaseMachineConfig, error) { 42 | resp := &BaseMachineConfig{} 43 | err := c.rancherClient.doUpdate(BASE_MACHINE_CONFIG_TYPE, &existing.Resource, updates, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *BaseMachineConfigClient) List(opts *ListOpts) (*BaseMachineConfigCollection, error) { 48 | resp := &BaseMachineConfigCollection{} 49 | err := c.rancherClient.doList(BASE_MACHINE_CONFIG_TYPE, opts, resp) 50 | resp.client = c 51 | return resp, err 52 | } 53 | 54 | func (cc *BaseMachineConfigCollection) Next() (*BaseMachineConfigCollection, error) { 55 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 56 | resp := &BaseMachineConfigCollection{} 57 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 58 | resp.client = cc.client 59 | return resp, err 60 | } 61 | return nil, nil 62 | } 63 | 64 | func (c *BaseMachineConfigClient) ById(id string) (*BaseMachineConfig, error) { 65 | resp := &BaseMachineConfig{} 66 | err := c.rancherClient.doById(BASE_MACHINE_CONFIG_TYPE, id, resp) 67 | if apiError, ok := err.(*ApiError); ok { 68 | if apiError.StatusCode == 404 { 69 | return nil, nil 70 | } 71 | } 72 | return resp, err 73 | } 74 | 75 | func (c *BaseMachineConfigClient) Delete(container *BaseMachineConfig) error { 76 | return c.rancherClient.doResourceDelete(BASE_MACHINE_CONFIG_TYPE, &container.Resource) 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_compose_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | COMPOSE_CONFIG_TYPE = "composeConfig" 5 | ) 6 | 7 | type ComposeConfig struct { 8 | Resource 9 | 10 | DockerComposeConfig string `json:"dockerComposeConfig,omitempty" yaml:"docker_compose_config,omitempty"` 11 | 12 | RancherComposeConfig string `json:"rancherComposeConfig,omitempty" yaml:"rancher_compose_config,omitempty"` 13 | } 14 | 15 | type ComposeConfigCollection struct { 16 | Collection 17 | Data []ComposeConfig `json:"data,omitempty"` 18 | client *ComposeConfigClient 19 | } 20 | 21 | type ComposeConfigClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type ComposeConfigOperations interface { 26 | List(opts *ListOpts) (*ComposeConfigCollection, error) 27 | Create(opts *ComposeConfig) (*ComposeConfig, error) 28 | Update(existing *ComposeConfig, updates interface{}) (*ComposeConfig, error) 29 | ById(id string) (*ComposeConfig, error) 30 | Delete(container *ComposeConfig) error 31 | } 32 | 33 | func newComposeConfigClient(rancherClient *RancherClient) *ComposeConfigClient { 34 | return &ComposeConfigClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *ComposeConfigClient) Create(container *ComposeConfig) (*ComposeConfig, error) { 40 | resp := &ComposeConfig{} 41 | err := c.rancherClient.doCreate(COMPOSE_CONFIG_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *ComposeConfigClient) Update(existing *ComposeConfig, updates interface{}) (*ComposeConfig, error) { 46 | resp := &ComposeConfig{} 47 | err := c.rancherClient.doUpdate(COMPOSE_CONFIG_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ComposeConfigClient) List(opts *ListOpts) (*ComposeConfigCollection, error) { 52 | resp := &ComposeConfigCollection{} 53 | err := c.rancherClient.doList(COMPOSE_CONFIG_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *ComposeConfigCollection) Next() (*ComposeConfigCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &ComposeConfigCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *ComposeConfigClient) ById(id string) (*ComposeConfig, error) { 69 | resp := &ComposeConfig{} 70 | err := c.rancherClient.doById(COMPOSE_CONFIG_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *ComposeConfigClient) Delete(container *ComposeConfig) error { 80 | return c.rancherClient.doResourceDelete(COMPOSE_CONFIG_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_compose_config_input.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | COMPOSE_CONFIG_INPUT_TYPE = "composeConfigInput" 5 | ) 6 | 7 | type ComposeConfigInput struct { 8 | Resource 9 | 10 | ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` 11 | } 12 | 13 | type ComposeConfigInputCollection struct { 14 | Collection 15 | Data []ComposeConfigInput `json:"data,omitempty"` 16 | client *ComposeConfigInputClient 17 | } 18 | 19 | type ComposeConfigInputClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ComposeConfigInputOperations interface { 24 | List(opts *ListOpts) (*ComposeConfigInputCollection, error) 25 | Create(opts *ComposeConfigInput) (*ComposeConfigInput, error) 26 | Update(existing *ComposeConfigInput, updates interface{}) (*ComposeConfigInput, error) 27 | ById(id string) (*ComposeConfigInput, error) 28 | Delete(container *ComposeConfigInput) error 29 | } 30 | 31 | func newComposeConfigInputClient(rancherClient *RancherClient) *ComposeConfigInputClient { 32 | return &ComposeConfigInputClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ComposeConfigInputClient) Create(container *ComposeConfigInput) (*ComposeConfigInput, error) { 38 | resp := &ComposeConfigInput{} 39 | err := c.rancherClient.doCreate(COMPOSE_CONFIG_INPUT_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ComposeConfigInputClient) Update(existing *ComposeConfigInput, updates interface{}) (*ComposeConfigInput, error) { 44 | resp := &ComposeConfigInput{} 45 | err := c.rancherClient.doUpdate(COMPOSE_CONFIG_INPUT_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ComposeConfigInputClient) List(opts *ListOpts) (*ComposeConfigInputCollection, error) { 50 | resp := &ComposeConfigInputCollection{} 51 | err := c.rancherClient.doList(COMPOSE_CONFIG_INPUT_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ComposeConfigInputCollection) Next() (*ComposeConfigInputCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ComposeConfigInputCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *ComposeConfigInputClient) ById(id string) (*ComposeConfigInput, error) { 67 | resp := &ComposeConfigInput{} 68 | err := c.rancherClient.doById(COMPOSE_CONFIG_INPUT_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *ComposeConfigInputClient) Delete(container *ComposeConfigInput) error { 78 | return c.rancherClient.doResourceDelete(COMPOSE_CONFIG_INPUT_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_container_exec.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONTAINER_EXEC_TYPE = "containerExec" 5 | ) 6 | 7 | type ContainerExec struct { 8 | Resource 9 | 10 | AttachStdin bool `json:"attachStdin,omitempty" yaml:"attach_stdin,omitempty"` 11 | 12 | AttachStdout bool `json:"attachStdout,omitempty" yaml:"attach_stdout,omitempty"` 13 | 14 | Command []string `json:"command,omitempty" yaml:"command,omitempty"` 15 | 16 | Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` 17 | } 18 | 19 | type ContainerExecCollection struct { 20 | Collection 21 | Data []ContainerExec `json:"data,omitempty"` 22 | client *ContainerExecClient 23 | } 24 | 25 | type ContainerExecClient struct { 26 | rancherClient *RancherClient 27 | } 28 | 29 | type ContainerExecOperations interface { 30 | List(opts *ListOpts) (*ContainerExecCollection, error) 31 | Create(opts *ContainerExec) (*ContainerExec, error) 32 | Update(existing *ContainerExec, updates interface{}) (*ContainerExec, error) 33 | ById(id string) (*ContainerExec, error) 34 | Delete(container *ContainerExec) error 35 | } 36 | 37 | func newContainerExecClient(rancherClient *RancherClient) *ContainerExecClient { 38 | return &ContainerExecClient{ 39 | rancherClient: rancherClient, 40 | } 41 | } 42 | 43 | func (c *ContainerExecClient) Create(container *ContainerExec) (*ContainerExec, error) { 44 | resp := &ContainerExec{} 45 | err := c.rancherClient.doCreate(CONTAINER_EXEC_TYPE, container, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ContainerExecClient) Update(existing *ContainerExec, updates interface{}) (*ContainerExec, error) { 50 | resp := &ContainerExec{} 51 | err := c.rancherClient.doUpdate(CONTAINER_EXEC_TYPE, &existing.Resource, updates, resp) 52 | return resp, err 53 | } 54 | 55 | func (c *ContainerExecClient) List(opts *ListOpts) (*ContainerExecCollection, error) { 56 | resp := &ContainerExecCollection{} 57 | err := c.rancherClient.doList(CONTAINER_EXEC_TYPE, opts, resp) 58 | resp.client = c 59 | return resp, err 60 | } 61 | 62 | func (cc *ContainerExecCollection) Next() (*ContainerExecCollection, error) { 63 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 64 | resp := &ContainerExecCollection{} 65 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 66 | resp.client = cc.client 67 | return resp, err 68 | } 69 | return nil, nil 70 | } 71 | 72 | func (c *ContainerExecClient) ById(id string) (*ContainerExec, error) { 73 | resp := &ContainerExec{} 74 | err := c.rancherClient.doById(CONTAINER_EXEC_TYPE, id, resp) 75 | if apiError, ok := err.(*ApiError); ok { 76 | if apiError.StatusCode == 404 { 77 | return nil, nil 78 | } 79 | } 80 | return resp, err 81 | } 82 | 83 | func (c *ContainerExecClient) Delete(container *ContainerExec) error { 84 | return c.rancherClient.doResourceDelete(CONTAINER_EXEC_TYPE, &container.Resource) 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_container_logs.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONTAINER_LOGS_TYPE = "containerLogs" 5 | ) 6 | 7 | type ContainerLogs struct { 8 | Resource 9 | 10 | Follow bool `json:"follow,omitempty" yaml:"follow,omitempty"` 11 | 12 | Lines int64 `json:"lines,omitempty" yaml:"lines,omitempty"` 13 | } 14 | 15 | type ContainerLogsCollection struct { 16 | Collection 17 | Data []ContainerLogs `json:"data,omitempty"` 18 | client *ContainerLogsClient 19 | } 20 | 21 | type ContainerLogsClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type ContainerLogsOperations interface { 26 | List(opts *ListOpts) (*ContainerLogsCollection, error) 27 | Create(opts *ContainerLogs) (*ContainerLogs, error) 28 | Update(existing *ContainerLogs, updates interface{}) (*ContainerLogs, error) 29 | ById(id string) (*ContainerLogs, error) 30 | Delete(container *ContainerLogs) error 31 | } 32 | 33 | func newContainerLogsClient(rancherClient *RancherClient) *ContainerLogsClient { 34 | return &ContainerLogsClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *ContainerLogsClient) Create(container *ContainerLogs) (*ContainerLogs, error) { 40 | resp := &ContainerLogs{} 41 | err := c.rancherClient.doCreate(CONTAINER_LOGS_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *ContainerLogsClient) Update(existing *ContainerLogs, updates interface{}) (*ContainerLogs, error) { 46 | resp := &ContainerLogs{} 47 | err := c.rancherClient.doUpdate(CONTAINER_LOGS_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ContainerLogsClient) List(opts *ListOpts) (*ContainerLogsCollection, error) { 52 | resp := &ContainerLogsCollection{} 53 | err := c.rancherClient.doList(CONTAINER_LOGS_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *ContainerLogsCollection) Next() (*ContainerLogsCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &ContainerLogsCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *ContainerLogsClient) ById(id string) (*ContainerLogs, error) { 69 | resp := &ContainerLogs{} 70 | err := c.rancherClient.doById(CONTAINER_LOGS_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *ContainerLogsClient) Delete(container *ContainerLogs) error { 80 | return c.rancherClient.doResourceDelete(CONTAINER_LOGS_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_container_proxy.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONTAINER_PROXY_TYPE = "containerProxy" 5 | ) 6 | 7 | type ContainerProxy struct { 8 | Resource 9 | 10 | Port int64 `json:"port,omitempty" yaml:"port,omitempty"` 11 | 12 | Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` 13 | } 14 | 15 | type ContainerProxyCollection struct { 16 | Collection 17 | Data []ContainerProxy `json:"data,omitempty"` 18 | client *ContainerProxyClient 19 | } 20 | 21 | type ContainerProxyClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type ContainerProxyOperations interface { 26 | List(opts *ListOpts) (*ContainerProxyCollection, error) 27 | Create(opts *ContainerProxy) (*ContainerProxy, error) 28 | Update(existing *ContainerProxy, updates interface{}) (*ContainerProxy, error) 29 | ById(id string) (*ContainerProxy, error) 30 | Delete(container *ContainerProxy) error 31 | } 32 | 33 | func newContainerProxyClient(rancherClient *RancherClient) *ContainerProxyClient { 34 | return &ContainerProxyClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *ContainerProxyClient) Create(container *ContainerProxy) (*ContainerProxy, error) { 40 | resp := &ContainerProxy{} 41 | err := c.rancherClient.doCreate(CONTAINER_PROXY_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *ContainerProxyClient) Update(existing *ContainerProxy, updates interface{}) (*ContainerProxy, error) { 46 | resp := &ContainerProxy{} 47 | err := c.rancherClient.doUpdate(CONTAINER_PROXY_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ContainerProxyClient) List(opts *ListOpts) (*ContainerProxyCollection, error) { 52 | resp := &ContainerProxyCollection{} 53 | err := c.rancherClient.doList(CONTAINER_PROXY_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *ContainerProxyCollection) Next() (*ContainerProxyCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &ContainerProxyCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *ContainerProxyClient) ById(id string) (*ContainerProxy, error) { 69 | resp := &ContainerProxy{} 70 | err := c.rancherClient.doById(CONTAINER_PROXY_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *ContainerProxyClient) Delete(container *ContainerProxy) error { 80 | return c.rancherClient.doResourceDelete(CONTAINER_PROXY_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_container_upgrade.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONTAINER_UPGRADE_TYPE = "containerUpgrade" 5 | ) 6 | 7 | type ContainerUpgrade struct { 8 | Resource 9 | 10 | Config ContainerConfig `json:"config,omitempty" yaml:"config,omitempty"` 11 | } 12 | 13 | type ContainerUpgradeCollection struct { 14 | Collection 15 | Data []ContainerUpgrade `json:"data,omitempty"` 16 | client *ContainerUpgradeClient 17 | } 18 | 19 | type ContainerUpgradeClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ContainerUpgradeOperations interface { 24 | List(opts *ListOpts) (*ContainerUpgradeCollection, error) 25 | Create(opts *ContainerUpgrade) (*ContainerUpgrade, error) 26 | Update(existing *ContainerUpgrade, updates interface{}) (*ContainerUpgrade, error) 27 | ById(id string) (*ContainerUpgrade, error) 28 | Delete(container *ContainerUpgrade) error 29 | } 30 | 31 | func newContainerUpgradeClient(rancherClient *RancherClient) *ContainerUpgradeClient { 32 | return &ContainerUpgradeClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ContainerUpgradeClient) Create(container *ContainerUpgrade) (*ContainerUpgrade, error) { 38 | resp := &ContainerUpgrade{} 39 | err := c.rancherClient.doCreate(CONTAINER_UPGRADE_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ContainerUpgradeClient) Update(existing *ContainerUpgrade, updates interface{}) (*ContainerUpgrade, error) { 44 | resp := &ContainerUpgrade{} 45 | err := c.rancherClient.doUpdate(CONTAINER_UPGRADE_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ContainerUpgradeClient) List(opts *ListOpts) (*ContainerUpgradeCollection, error) { 50 | resp := &ContainerUpgradeCollection{} 51 | err := c.rancherClient.doList(CONTAINER_UPGRADE_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ContainerUpgradeCollection) Next() (*ContainerUpgradeCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ContainerUpgradeCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *ContainerUpgradeClient) ById(id string) (*ContainerUpgrade, error) { 67 | resp := &ContainerUpgrade{} 68 | err := c.rancherClient.doById(CONTAINER_UPGRADE_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *ContainerUpgradeClient) Delete(container *ContainerUpgrade) error { 78 | return c.rancherClient.doResourceDelete(CONTAINER_UPGRADE_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_depends_on.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | DEPENDS_ON_TYPE = "dependsOn" 5 | ) 6 | 7 | type DependsOn struct { 8 | Resource 9 | 10 | Condition string `json:"condition,omitempty" yaml:"condition,omitempty"` 11 | 12 | Container string `json:"container,omitempty" yaml:"container,omitempty"` 13 | 14 | Service string `json:"service,omitempty" yaml:"service,omitempty"` 15 | } 16 | 17 | type DependsOnCollection struct { 18 | Collection 19 | Data []DependsOn `json:"data,omitempty"` 20 | client *DependsOnClient 21 | } 22 | 23 | type DependsOnClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type DependsOnOperations interface { 28 | List(opts *ListOpts) (*DependsOnCollection, error) 29 | Create(opts *DependsOn) (*DependsOn, error) 30 | Update(existing *DependsOn, updates interface{}) (*DependsOn, error) 31 | ById(id string) (*DependsOn, error) 32 | Delete(container *DependsOn) error 33 | } 34 | 35 | func newDependsOnClient(rancherClient *RancherClient) *DependsOnClient { 36 | return &DependsOnClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *DependsOnClient) Create(container *DependsOn) (*DependsOn, error) { 42 | resp := &DependsOn{} 43 | err := c.rancherClient.doCreate(DEPENDS_ON_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *DependsOnClient) Update(existing *DependsOn, updates interface{}) (*DependsOn, error) { 48 | resp := &DependsOn{} 49 | err := c.rancherClient.doUpdate(DEPENDS_ON_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *DependsOnClient) List(opts *ListOpts) (*DependsOnCollection, error) { 54 | resp := &DependsOnCollection{} 55 | err := c.rancherClient.doList(DEPENDS_ON_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *DependsOnCollection) Next() (*DependsOnCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &DependsOnCollection{} 63 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 64 | resp.client = cc.client 65 | return resp, err 66 | } 67 | return nil, nil 68 | } 69 | 70 | func (c *DependsOnClient) ById(id string) (*DependsOn, error) { 71 | resp := &DependsOn{} 72 | err := c.rancherClient.doById(DEPENDS_ON_TYPE, id, resp) 73 | if apiError, ok := err.(*ApiError); ok { 74 | if apiError.StatusCode == 404 { 75 | return nil, nil 76 | } 77 | } 78 | return resp, err 79 | } 80 | 81 | func (c *DependsOnClient) Delete(container *DependsOn) error { 82 | return c.rancherClient.doResourceDelete(DEPENDS_ON_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_error.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | ERROR_TYPE = "error" 5 | ) 6 | 7 | type Error struct { 8 | Resource 9 | 10 | Code string `json:"code,omitempty" yaml:"code,omitempty"` 11 | 12 | Detail string `json:"detail,omitempty" yaml:"detail,omitempty"` 13 | 14 | Message string `json:"message,omitempty" yaml:"message,omitempty"` 15 | 16 | Status int64 `json:"status,omitempty" yaml:"status,omitempty"` 17 | } 18 | 19 | type ErrorCollection struct { 20 | Collection 21 | Data []Error `json:"data,omitempty"` 22 | client *ErrorClient 23 | } 24 | 25 | type ErrorClient struct { 26 | rancherClient *RancherClient 27 | } 28 | 29 | type ErrorOperations interface { 30 | List(opts *ListOpts) (*ErrorCollection, error) 31 | Create(opts *Error) (*Error, error) 32 | Update(existing *Error, updates interface{}) (*Error, error) 33 | ById(id string) (*Error, error) 34 | Delete(container *Error) error 35 | } 36 | 37 | func newErrorClient(rancherClient *RancherClient) *ErrorClient { 38 | return &ErrorClient{ 39 | rancherClient: rancherClient, 40 | } 41 | } 42 | 43 | func (c *ErrorClient) Create(container *Error) (*Error, error) { 44 | resp := &Error{} 45 | err := c.rancherClient.doCreate(ERROR_TYPE, container, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ErrorClient) Update(existing *Error, updates interface{}) (*Error, error) { 50 | resp := &Error{} 51 | err := c.rancherClient.doUpdate(ERROR_TYPE, &existing.Resource, updates, resp) 52 | return resp, err 53 | } 54 | 55 | func (c *ErrorClient) List(opts *ListOpts) (*ErrorCollection, error) { 56 | resp := &ErrorCollection{} 57 | err := c.rancherClient.doList(ERROR_TYPE, opts, resp) 58 | resp.client = c 59 | return resp, err 60 | } 61 | 62 | func (cc *ErrorCollection) Next() (*ErrorCollection, error) { 63 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 64 | resp := &ErrorCollection{} 65 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 66 | resp.client = cc.client 67 | return resp, err 68 | } 69 | return nil, nil 70 | } 71 | 72 | func (c *ErrorClient) ById(id string) (*Error, error) { 73 | resp := &Error{} 74 | err := c.rancherClient.doById(ERROR_TYPE, id, resp) 75 | if apiError, ok := err.(*ApiError); ok { 76 | if apiError.StatusCode == 404 { 77 | return nil, nil 78 | } 79 | } 80 | return resp, err 81 | } 82 | 83 | func (c *ErrorClient) Delete(container *Error) error { 84 | return c.rancherClient.doResourceDelete(ERROR_TYPE, &container.Resource) 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_field_documentation.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | FIELD_DOCUMENTATION_TYPE = "fieldDocumentation" 5 | ) 6 | 7 | type FieldDocumentation struct { 8 | Resource 9 | 10 | Description string `json:"description,omitempty" yaml:"description,omitempty"` 11 | } 12 | 13 | type FieldDocumentationCollection struct { 14 | Collection 15 | Data []FieldDocumentation `json:"data,omitempty"` 16 | client *FieldDocumentationClient 17 | } 18 | 19 | type FieldDocumentationClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type FieldDocumentationOperations interface { 24 | List(opts *ListOpts) (*FieldDocumentationCollection, error) 25 | Create(opts *FieldDocumentation) (*FieldDocumentation, error) 26 | Update(existing *FieldDocumentation, updates interface{}) (*FieldDocumentation, error) 27 | ById(id string) (*FieldDocumentation, error) 28 | Delete(container *FieldDocumentation) error 29 | } 30 | 31 | func newFieldDocumentationClient(rancherClient *RancherClient) *FieldDocumentationClient { 32 | return &FieldDocumentationClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *FieldDocumentationClient) Create(container *FieldDocumentation) (*FieldDocumentation, error) { 38 | resp := &FieldDocumentation{} 39 | err := c.rancherClient.doCreate(FIELD_DOCUMENTATION_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *FieldDocumentationClient) Update(existing *FieldDocumentation, updates interface{}) (*FieldDocumentation, error) { 44 | resp := &FieldDocumentation{} 45 | err := c.rancherClient.doUpdate(FIELD_DOCUMENTATION_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *FieldDocumentationClient) List(opts *ListOpts) (*FieldDocumentationCollection, error) { 50 | resp := &FieldDocumentationCollection{} 51 | err := c.rancherClient.doList(FIELD_DOCUMENTATION_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *FieldDocumentationCollection) Next() (*FieldDocumentationCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &FieldDocumentationCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *FieldDocumentationClient) ById(id string) (*FieldDocumentation, error) { 67 | resp := &FieldDocumentation{} 68 | err := c.rancherClient.doById(FIELD_DOCUMENTATION_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *FieldDocumentationClient) Delete(container *FieldDocumentation) error { 78 | return c.rancherClient.doResourceDelete(FIELD_DOCUMENTATION_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_ha_membership.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HA_MEMBERSHIP_TYPE = "haMembership" 5 | ) 6 | 7 | type HaMembership struct { 8 | Resource 9 | 10 | Clustered bool `json:"clustered,omitempty" yaml:"clustered,omitempty"` 11 | 12 | Config string `json:"config,omitempty" yaml:"config,omitempty"` 13 | 14 | Heartbeat int64 `json:"heartbeat,omitempty" yaml:"heartbeat,omitempty"` 15 | 16 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 17 | 18 | Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` 19 | } 20 | 21 | type HaMembershipCollection struct { 22 | Collection 23 | Data []HaMembership `json:"data,omitempty"` 24 | client *HaMembershipClient 25 | } 26 | 27 | type HaMembershipClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type HaMembershipOperations interface { 32 | List(opts *ListOpts) (*HaMembershipCollection, error) 33 | Create(opts *HaMembership) (*HaMembership, error) 34 | Update(existing *HaMembership, updates interface{}) (*HaMembership, error) 35 | ById(id string) (*HaMembership, error) 36 | Delete(container *HaMembership) error 37 | } 38 | 39 | func newHaMembershipClient(rancherClient *RancherClient) *HaMembershipClient { 40 | return &HaMembershipClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *HaMembershipClient) Create(container *HaMembership) (*HaMembership, error) { 46 | resp := &HaMembership{} 47 | err := c.rancherClient.doCreate(HA_MEMBERSHIP_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *HaMembershipClient) Update(existing *HaMembership, updates interface{}) (*HaMembership, error) { 52 | resp := &HaMembership{} 53 | err := c.rancherClient.doUpdate(HA_MEMBERSHIP_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *HaMembershipClient) List(opts *ListOpts) (*HaMembershipCollection, error) { 58 | resp := &HaMembershipCollection{} 59 | err := c.rancherClient.doList(HA_MEMBERSHIP_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *HaMembershipCollection) Next() (*HaMembershipCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &HaMembershipCollection{} 67 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 68 | resp.client = cc.client 69 | return resp, err 70 | } 71 | return nil, nil 72 | } 73 | 74 | func (c *HaMembershipClient) ById(id string) (*HaMembership, error) { 75 | resp := &HaMembership{} 76 | err := c.rancherClient.doById(HA_MEMBERSHIP_TYPE, id, resp) 77 | if apiError, ok := err.(*ApiError); ok { 78 | if apiError.StatusCode == 404 { 79 | return nil, nil 80 | } 81 | } 82 | return resp, err 83 | } 84 | 85 | func (c *HaMembershipClient) Delete(container *HaMembership) error { 86 | return c.rancherClient.doResourceDelete(HA_MEMBERSHIP_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_healthcheck_state.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HEALTHCHECK_STATE_TYPE = "healthcheckState" 5 | ) 6 | 7 | type HealthcheckState struct { 8 | Resource 9 | 10 | HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` 11 | 12 | HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` 13 | } 14 | 15 | type HealthcheckStateCollection struct { 16 | Collection 17 | Data []HealthcheckState `json:"data,omitempty"` 18 | client *HealthcheckStateClient 19 | } 20 | 21 | type HealthcheckStateClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type HealthcheckStateOperations interface { 26 | List(opts *ListOpts) (*HealthcheckStateCollection, error) 27 | Create(opts *HealthcheckState) (*HealthcheckState, error) 28 | Update(existing *HealthcheckState, updates interface{}) (*HealthcheckState, error) 29 | ById(id string) (*HealthcheckState, error) 30 | Delete(container *HealthcheckState) error 31 | } 32 | 33 | func newHealthcheckStateClient(rancherClient *RancherClient) *HealthcheckStateClient { 34 | return &HealthcheckStateClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *HealthcheckStateClient) Create(container *HealthcheckState) (*HealthcheckState, error) { 40 | resp := &HealthcheckState{} 41 | err := c.rancherClient.doCreate(HEALTHCHECK_STATE_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *HealthcheckStateClient) Update(existing *HealthcheckState, updates interface{}) (*HealthcheckState, error) { 46 | resp := &HealthcheckState{} 47 | err := c.rancherClient.doUpdate(HEALTHCHECK_STATE_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *HealthcheckStateClient) List(opts *ListOpts) (*HealthcheckStateCollection, error) { 52 | resp := &HealthcheckStateCollection{} 53 | err := c.rancherClient.doList(HEALTHCHECK_STATE_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *HealthcheckStateCollection) Next() (*HealthcheckStateCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &HealthcheckStateCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *HealthcheckStateClient) ById(id string) (*HealthcheckState, error) { 69 | resp := &HealthcheckState{} 70 | err := c.rancherClient.doById(HEALTHCHECK_STATE_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *HealthcheckStateClient) Delete(container *HealthcheckState) error { 80 | return c.rancherClient.doResourceDelete(HEALTHCHECK_STATE_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_host_access.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HOST_ACCESS_TYPE = "hostAccess" 5 | ) 6 | 7 | type HostAccess struct { 8 | Resource 9 | 10 | Token string `json:"token,omitempty" yaml:"token,omitempty"` 11 | 12 | Url string `json:"url,omitempty" yaml:"url,omitempty"` 13 | } 14 | 15 | type HostAccessCollection struct { 16 | Collection 17 | Data []HostAccess `json:"data,omitempty"` 18 | client *HostAccessClient 19 | } 20 | 21 | type HostAccessClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type HostAccessOperations interface { 26 | List(opts *ListOpts) (*HostAccessCollection, error) 27 | Create(opts *HostAccess) (*HostAccess, error) 28 | Update(existing *HostAccess, updates interface{}) (*HostAccess, error) 29 | ById(id string) (*HostAccess, error) 30 | Delete(container *HostAccess) error 31 | } 32 | 33 | func newHostAccessClient(rancherClient *RancherClient) *HostAccessClient { 34 | return &HostAccessClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *HostAccessClient) Create(container *HostAccess) (*HostAccess, error) { 40 | resp := &HostAccess{} 41 | err := c.rancherClient.doCreate(HOST_ACCESS_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *HostAccessClient) Update(existing *HostAccess, updates interface{}) (*HostAccess, error) { 46 | resp := &HostAccess{} 47 | err := c.rancherClient.doUpdate(HOST_ACCESS_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *HostAccessClient) List(opts *ListOpts) (*HostAccessCollection, error) { 52 | resp := &HostAccessCollection{} 53 | err := c.rancherClient.doList(HOST_ACCESS_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *HostAccessCollection) Next() (*HostAccessCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &HostAccessCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *HostAccessClient) ById(id string) (*HostAccess, error) { 69 | resp := &HostAccess{} 70 | err := c.rancherClient.doById(HOST_ACCESS_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *HostAccessClient) Delete(container *HostAccess) error { 80 | return c.rancherClient.doResourceDelete(HOST_ACCESS_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_instance_console.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | INSTANCE_CONSOLE_TYPE = "instanceConsole" 5 | ) 6 | 7 | type InstanceConsole struct { 8 | Resource 9 | 10 | Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` 11 | 12 | Password string `json:"password,omitempty" yaml:"password,omitempty"` 13 | 14 | Url string `json:"url,omitempty" yaml:"url,omitempty"` 15 | } 16 | 17 | type InstanceConsoleCollection struct { 18 | Collection 19 | Data []InstanceConsole `json:"data,omitempty"` 20 | client *InstanceConsoleClient 21 | } 22 | 23 | type InstanceConsoleClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type InstanceConsoleOperations interface { 28 | List(opts *ListOpts) (*InstanceConsoleCollection, error) 29 | Create(opts *InstanceConsole) (*InstanceConsole, error) 30 | Update(existing *InstanceConsole, updates interface{}) (*InstanceConsole, error) 31 | ById(id string) (*InstanceConsole, error) 32 | Delete(container *InstanceConsole) error 33 | } 34 | 35 | func newInstanceConsoleClient(rancherClient *RancherClient) *InstanceConsoleClient { 36 | return &InstanceConsoleClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *InstanceConsoleClient) Create(container *InstanceConsole) (*InstanceConsole, error) { 42 | resp := &InstanceConsole{} 43 | err := c.rancherClient.doCreate(INSTANCE_CONSOLE_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *InstanceConsoleClient) Update(existing *InstanceConsole, updates interface{}) (*InstanceConsole, error) { 48 | resp := &InstanceConsole{} 49 | err := c.rancherClient.doUpdate(INSTANCE_CONSOLE_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *InstanceConsoleClient) List(opts *ListOpts) (*InstanceConsoleCollection, error) { 54 | resp := &InstanceConsoleCollection{} 55 | err := c.rancherClient.doList(INSTANCE_CONSOLE_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *InstanceConsoleCollection) Next() (*InstanceConsoleCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &InstanceConsoleCollection{} 63 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 64 | resp.client = cc.client 65 | return resp, err 66 | } 67 | return nil, nil 68 | } 69 | 70 | func (c *InstanceConsoleClient) ById(id string) (*InstanceConsole, error) { 71 | resp := &InstanceConsole{} 72 | err := c.rancherClient.doById(INSTANCE_CONSOLE_TYPE, id, resp) 73 | if apiError, ok := err.(*ApiError); ok { 74 | if apiError.StatusCode == 404 { 75 | return nil, nil 76 | } 77 | } 78 | return resp, err 79 | } 80 | 81 | func (c *InstanceConsoleClient) Delete(container *InstanceConsole) error { 82 | return c.rancherClient.doResourceDelete(INSTANCE_CONSOLE_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_instance_console_input.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | INSTANCE_CONSOLE_INPUT_TYPE = "instanceConsoleInput" 5 | ) 6 | 7 | type InstanceConsoleInput struct { 8 | Resource 9 | } 10 | 11 | type InstanceConsoleInputCollection struct { 12 | Collection 13 | Data []InstanceConsoleInput `json:"data,omitempty"` 14 | client *InstanceConsoleInputClient 15 | } 16 | 17 | type InstanceConsoleInputClient struct { 18 | rancherClient *RancherClient 19 | } 20 | 21 | type InstanceConsoleInputOperations interface { 22 | List(opts *ListOpts) (*InstanceConsoleInputCollection, error) 23 | Create(opts *InstanceConsoleInput) (*InstanceConsoleInput, error) 24 | Update(existing *InstanceConsoleInput, updates interface{}) (*InstanceConsoleInput, error) 25 | ById(id string) (*InstanceConsoleInput, error) 26 | Delete(container *InstanceConsoleInput) error 27 | } 28 | 29 | func newInstanceConsoleInputClient(rancherClient *RancherClient) *InstanceConsoleInputClient { 30 | return &InstanceConsoleInputClient{ 31 | rancherClient: rancherClient, 32 | } 33 | } 34 | 35 | func (c *InstanceConsoleInputClient) Create(container *InstanceConsoleInput) (*InstanceConsoleInput, error) { 36 | resp := &InstanceConsoleInput{} 37 | err := c.rancherClient.doCreate(INSTANCE_CONSOLE_INPUT_TYPE, container, resp) 38 | return resp, err 39 | } 40 | 41 | func (c *InstanceConsoleInputClient) Update(existing *InstanceConsoleInput, updates interface{}) (*InstanceConsoleInput, error) { 42 | resp := &InstanceConsoleInput{} 43 | err := c.rancherClient.doUpdate(INSTANCE_CONSOLE_INPUT_TYPE, &existing.Resource, updates, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *InstanceConsoleInputClient) List(opts *ListOpts) (*InstanceConsoleInputCollection, error) { 48 | resp := &InstanceConsoleInputCollection{} 49 | err := c.rancherClient.doList(INSTANCE_CONSOLE_INPUT_TYPE, opts, resp) 50 | resp.client = c 51 | return resp, err 52 | } 53 | 54 | func (cc *InstanceConsoleInputCollection) Next() (*InstanceConsoleInputCollection, error) { 55 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 56 | resp := &InstanceConsoleInputCollection{} 57 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 58 | resp.client = cc.client 59 | return resp, err 60 | } 61 | return nil, nil 62 | } 63 | 64 | func (c *InstanceConsoleInputClient) ById(id string) (*InstanceConsoleInput, error) { 65 | resp := &InstanceConsoleInput{} 66 | err := c.rancherClient.doById(INSTANCE_CONSOLE_INPUT_TYPE, id, resp) 67 | if apiError, ok := err.(*ApiError); ok { 68 | if apiError.StatusCode == 404 { 69 | return nil, nil 70 | } 71 | } 72 | return resp, err 73 | } 74 | 75 | func (c *InstanceConsoleInputClient) Delete(container *InstanceConsoleInput) error { 76 | return c.rancherClient.doResourceDelete(INSTANCE_CONSOLE_INPUT_TYPE, &container.Resource) 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_instance_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | INSTANCE_REMOVE_TYPE = "instanceRemove" 5 | ) 6 | 7 | type InstanceRemove struct { 8 | Resource 9 | 10 | RemoveSource string `json:"removeSource,omitempty" yaml:"remove_source,omitempty"` 11 | } 12 | 13 | type InstanceRemoveCollection struct { 14 | Collection 15 | Data []InstanceRemove `json:"data,omitempty"` 16 | client *InstanceRemoveClient 17 | } 18 | 19 | type InstanceRemoveClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type InstanceRemoveOperations interface { 24 | List(opts *ListOpts) (*InstanceRemoveCollection, error) 25 | Create(opts *InstanceRemove) (*InstanceRemove, error) 26 | Update(existing *InstanceRemove, updates interface{}) (*InstanceRemove, error) 27 | ById(id string) (*InstanceRemove, error) 28 | Delete(container *InstanceRemove) error 29 | } 30 | 31 | func newInstanceRemoveClient(rancherClient *RancherClient) *InstanceRemoveClient { 32 | return &InstanceRemoveClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *InstanceRemoveClient) Create(container *InstanceRemove) (*InstanceRemove, error) { 38 | resp := &InstanceRemove{} 39 | err := c.rancherClient.doCreate(INSTANCE_REMOVE_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *InstanceRemoveClient) Update(existing *InstanceRemove, updates interface{}) (*InstanceRemove, error) { 44 | resp := &InstanceRemove{} 45 | err := c.rancherClient.doUpdate(INSTANCE_REMOVE_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *InstanceRemoveClient) List(opts *ListOpts) (*InstanceRemoveCollection, error) { 50 | resp := &InstanceRemoveCollection{} 51 | err := c.rancherClient.doList(INSTANCE_REMOVE_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *InstanceRemoveCollection) Next() (*InstanceRemoveCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &InstanceRemoveCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *InstanceRemoveClient) ById(id string) (*InstanceRemove, error) { 67 | resp := &InstanceRemove{} 68 | err := c.rancherClient.doById(INSTANCE_REMOVE_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *InstanceRemoveClient) Delete(container *InstanceRemove) error { 78 | return c.rancherClient.doResourceDelete(INSTANCE_REMOVE_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_instance_stop.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | INSTANCE_STOP_TYPE = "instanceStop" 5 | ) 6 | 7 | type InstanceStop struct { 8 | Resource 9 | 10 | Remove bool `json:"remove,omitempty" yaml:"remove,omitempty"` 11 | 12 | StopSource string `json:"stopSource,omitempty" yaml:"stop_source,omitempty"` 13 | 14 | Timeout int64 `json:"timeout,omitempty" yaml:"timeout,omitempty"` 15 | } 16 | 17 | type InstanceStopCollection struct { 18 | Collection 19 | Data []InstanceStop `json:"data,omitempty"` 20 | client *InstanceStopClient 21 | } 22 | 23 | type InstanceStopClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type InstanceStopOperations interface { 28 | List(opts *ListOpts) (*InstanceStopCollection, error) 29 | Create(opts *InstanceStop) (*InstanceStop, error) 30 | Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) 31 | ById(id string) (*InstanceStop, error) 32 | Delete(container *InstanceStop) error 33 | } 34 | 35 | func newInstanceStopClient(rancherClient *RancherClient) *InstanceStopClient { 36 | return &InstanceStopClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *InstanceStopClient) Create(container *InstanceStop) (*InstanceStop, error) { 42 | resp := &InstanceStop{} 43 | err := c.rancherClient.doCreate(INSTANCE_STOP_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *InstanceStopClient) Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) { 48 | resp := &InstanceStop{} 49 | err := c.rancherClient.doUpdate(INSTANCE_STOP_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *InstanceStopClient) List(opts *ListOpts) (*InstanceStopCollection, error) { 54 | resp := &InstanceStopCollection{} 55 | err := c.rancherClient.doList(INSTANCE_STOP_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *InstanceStopCollection) Next() (*InstanceStopCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &InstanceStopCollection{} 63 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 64 | resp.client = cc.client 65 | return resp, err 66 | } 67 | return nil, nil 68 | } 69 | 70 | func (c *InstanceStopClient) ById(id string) (*InstanceStop, error) { 71 | resp := &InstanceStop{} 72 | err := c.rancherClient.doById(INSTANCE_STOP_TYPE, id, resp) 73 | if apiError, ok := err.(*ApiError); ok { 74 | if apiError.StatusCode == 404 { 75 | return nil, nil 76 | } 77 | } 78 | return resp, err 79 | } 80 | 81 | func (c *InstanceStopClient) Delete(container *InstanceStop) error { 82 | return c.rancherClient.doResourceDelete(INSTANCE_STOP_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_k8s_client_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | K8S_CLIENT_CONFIG_TYPE = "k8sClientConfig" 5 | ) 6 | 7 | type K8sClientConfig struct { 8 | Resource 9 | 10 | Address string `json:"address,omitempty" yaml:"address,omitempty"` 11 | 12 | BearerToken string `json:"bearerToken,omitempty" yaml:"bearer_token,omitempty"` 13 | 14 | CaCert string `json:"caCert,omitempty" yaml:"ca_cert,omitempty"` 15 | } 16 | 17 | type K8sClientConfigCollection struct { 18 | Collection 19 | Data []K8sClientConfig `json:"data,omitempty"` 20 | client *K8sClientConfigClient 21 | } 22 | 23 | type K8sClientConfigClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type K8sClientConfigOperations interface { 28 | List(opts *ListOpts) (*K8sClientConfigCollection, error) 29 | Create(opts *K8sClientConfig) (*K8sClientConfig, error) 30 | Update(existing *K8sClientConfig, updates interface{}) (*K8sClientConfig, error) 31 | ById(id string) (*K8sClientConfig, error) 32 | Delete(container *K8sClientConfig) error 33 | } 34 | 35 | func newK8sClientConfigClient(rancherClient *RancherClient) *K8sClientConfigClient { 36 | return &K8sClientConfigClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *K8sClientConfigClient) Create(container *K8sClientConfig) (*K8sClientConfig, error) { 42 | resp := &K8sClientConfig{} 43 | err := c.rancherClient.doCreate(K8S_CLIENT_CONFIG_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *K8sClientConfigClient) Update(existing *K8sClientConfig, updates interface{}) (*K8sClientConfig, error) { 48 | resp := &K8sClientConfig{} 49 | err := c.rancherClient.doUpdate(K8S_CLIENT_CONFIG_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *K8sClientConfigClient) List(opts *ListOpts) (*K8sClientConfigCollection, error) { 54 | resp := &K8sClientConfigCollection{} 55 | err := c.rancherClient.doList(K8S_CLIENT_CONFIG_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *K8sClientConfigCollection) Next() (*K8sClientConfigCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &K8sClientConfigCollection{} 63 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 64 | resp.client = cc.client 65 | return resp, err 66 | } 67 | return nil, nil 68 | } 69 | 70 | func (c *K8sClientConfigClient) ById(id string) (*K8sClientConfig, error) { 71 | resp := &K8sClientConfig{} 72 | err := c.rancherClient.doById(K8S_CLIENT_CONFIG_TYPE, id, resp) 73 | if apiError, ok := err.(*ApiError); ok { 74 | if apiError.StatusCode == 404 { 75 | return nil, nil 76 | } 77 | } 78 | return resp, err 79 | } 80 | 81 | func (c *K8sClientConfigClient) Delete(container *K8sClientConfig) error { 82 | return c.rancherClient.doResourceDelete(K8S_CLIENT_CONFIG_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_k8s_server_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | K8S_SERVER_CONFIG_TYPE = "k8sServerConfig" 5 | ) 6 | 7 | type K8sServerConfig struct { 8 | Resource 9 | 10 | AdmissionControllers []string `json:"admissionControllers,omitempty" yaml:"admission_controllers,omitempty"` 11 | 12 | ServiceNetCidr string `json:"serviceNetCidr,omitempty" yaml:"service_net_cidr,omitempty"` 13 | } 14 | 15 | type K8sServerConfigCollection struct { 16 | Collection 17 | Data []K8sServerConfig `json:"data,omitempty"` 18 | client *K8sServerConfigClient 19 | } 20 | 21 | type K8sServerConfigClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type K8sServerConfigOperations interface { 26 | List(opts *ListOpts) (*K8sServerConfigCollection, error) 27 | Create(opts *K8sServerConfig) (*K8sServerConfig, error) 28 | Update(existing *K8sServerConfig, updates interface{}) (*K8sServerConfig, error) 29 | ById(id string) (*K8sServerConfig, error) 30 | Delete(container *K8sServerConfig) error 31 | } 32 | 33 | func newK8sServerConfigClient(rancherClient *RancherClient) *K8sServerConfigClient { 34 | return &K8sServerConfigClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *K8sServerConfigClient) Create(container *K8sServerConfig) (*K8sServerConfig, error) { 40 | resp := &K8sServerConfig{} 41 | err := c.rancherClient.doCreate(K8S_SERVER_CONFIG_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *K8sServerConfigClient) Update(existing *K8sServerConfig, updates interface{}) (*K8sServerConfig, error) { 46 | resp := &K8sServerConfig{} 47 | err := c.rancherClient.doUpdate(K8S_SERVER_CONFIG_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *K8sServerConfigClient) List(opts *ListOpts) (*K8sServerConfigCollection, error) { 52 | resp := &K8sServerConfigCollection{} 53 | err := c.rancherClient.doList(K8S_SERVER_CONFIG_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *K8sServerConfigCollection) Next() (*K8sServerConfigCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &K8sServerConfigCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *K8sServerConfigClient) ById(id string) (*K8sServerConfig, error) { 69 | resp := &K8sServerConfig{} 70 | err := c.rancherClient.doById(K8S_SERVER_CONFIG_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *K8sServerConfigClient) Delete(container *K8sServerConfig) error { 80 | return c.rancherClient.doResourceDelete(K8S_SERVER_CONFIG_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_lb_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | LB_CONFIG_TYPE = "lbConfig" 5 | ) 6 | 7 | type LbConfig struct { 8 | Resource 9 | 10 | CertificateIds []string `json:"certificateIds,omitempty" yaml:"certificate_ids,omitempty"` 11 | 12 | Config string `json:"config,omitempty" yaml:"config,omitempty"` 13 | 14 | DefaultCertificateId string `json:"defaultCertificateId,omitempty" yaml:"default_certificate_id,omitempty"` 15 | 16 | PortRules []PortRule `json:"portRules,omitempty" yaml:"port_rules,omitempty"` 17 | 18 | StickinessPolicy *LoadBalancerCookieStickinessPolicy `json:"stickinessPolicy,omitempty" yaml:"stickiness_policy,omitempty"` 19 | } 20 | 21 | type LbConfigCollection struct { 22 | Collection 23 | Data []LbConfig `json:"data,omitempty"` 24 | client *LbConfigClient 25 | } 26 | 27 | type LbConfigClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type LbConfigOperations interface { 32 | List(opts *ListOpts) (*LbConfigCollection, error) 33 | Create(opts *LbConfig) (*LbConfig, error) 34 | Update(existing *LbConfig, updates interface{}) (*LbConfig, error) 35 | ById(id string) (*LbConfig, error) 36 | Delete(container *LbConfig) error 37 | } 38 | 39 | func newLbConfigClient(rancherClient *RancherClient) *LbConfigClient { 40 | return &LbConfigClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *LbConfigClient) Create(container *LbConfig) (*LbConfig, error) { 46 | resp := &LbConfig{} 47 | err := c.rancherClient.doCreate(LB_CONFIG_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *LbConfigClient) Update(existing *LbConfig, updates interface{}) (*LbConfig, error) { 52 | resp := &LbConfig{} 53 | err := c.rancherClient.doUpdate(LB_CONFIG_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *LbConfigClient) List(opts *ListOpts) (*LbConfigCollection, error) { 58 | resp := &LbConfigCollection{} 59 | err := c.rancherClient.doList(LB_CONFIG_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *LbConfigCollection) Next() (*LbConfigCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &LbConfigCollection{} 67 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 68 | resp.client = cc.client 69 | return resp, err 70 | } 71 | return nil, nil 72 | } 73 | 74 | func (c *LbConfigClient) ById(id string) (*LbConfig, error) { 75 | resp := &LbConfig{} 76 | err := c.rancherClient.doById(LB_CONFIG_TYPE, id, resp) 77 | if apiError, ok := err.(*ApiError); ok { 78 | if apiError.StatusCode == 404 { 79 | return nil, nil 80 | } 81 | } 82 | return resp, err 83 | } 84 | 85 | func (c *LbConfigClient) Delete(container *LbConfig) error { 86 | return c.rancherClient.doResourceDelete(LB_CONFIG_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_lb_target_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | LB_TARGET_CONFIG_TYPE = "lbTargetConfig" 5 | ) 6 | 7 | type LbTargetConfig struct { 8 | Resource 9 | 10 | PortRules []TargetPortRule `json:"portRules,omitempty" yaml:"port_rules,omitempty"` 11 | } 12 | 13 | type LbTargetConfigCollection struct { 14 | Collection 15 | Data []LbTargetConfig `json:"data,omitempty"` 16 | client *LbTargetConfigClient 17 | } 18 | 19 | type LbTargetConfigClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type LbTargetConfigOperations interface { 24 | List(opts *ListOpts) (*LbTargetConfigCollection, error) 25 | Create(opts *LbTargetConfig) (*LbTargetConfig, error) 26 | Update(existing *LbTargetConfig, updates interface{}) (*LbTargetConfig, error) 27 | ById(id string) (*LbTargetConfig, error) 28 | Delete(container *LbTargetConfig) error 29 | } 30 | 31 | func newLbTargetConfigClient(rancherClient *RancherClient) *LbTargetConfigClient { 32 | return &LbTargetConfigClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *LbTargetConfigClient) Create(container *LbTargetConfig) (*LbTargetConfig, error) { 38 | resp := &LbTargetConfig{} 39 | err := c.rancherClient.doCreate(LB_TARGET_CONFIG_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *LbTargetConfigClient) Update(existing *LbTargetConfig, updates interface{}) (*LbTargetConfig, error) { 44 | resp := &LbTargetConfig{} 45 | err := c.rancherClient.doUpdate(LB_TARGET_CONFIG_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *LbTargetConfigClient) List(opts *ListOpts) (*LbTargetConfigCollection, error) { 50 | resp := &LbTargetConfigCollection{} 51 | err := c.rancherClient.doList(LB_TARGET_CONFIG_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *LbTargetConfigCollection) Next() (*LbTargetConfigCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &LbTargetConfigCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *LbTargetConfigClient) ById(id string) (*LbTargetConfig, error) { 67 | resp := &LbTargetConfig{} 68 | err := c.rancherClient.doById(LB_TARGET_CONFIG_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *LbTargetConfigClient) Delete(container *LbTargetConfig) error { 78 | return c.rancherClient.doResourceDelete(LB_TARGET_CONFIG_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_link.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | LINK_TYPE = "link" 5 | ) 6 | 7 | type Link struct { 8 | Resource 9 | 10 | Alias string `json:"alias,omitempty" yaml:"alias,omitempty"` 11 | 12 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 13 | } 14 | 15 | type LinkCollection struct { 16 | Collection 17 | Data []Link `json:"data,omitempty"` 18 | client *LinkClient 19 | } 20 | 21 | type LinkClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type LinkOperations interface { 26 | List(opts *ListOpts) (*LinkCollection, error) 27 | Create(opts *Link) (*Link, error) 28 | Update(existing *Link, updates interface{}) (*Link, error) 29 | ById(id string) (*Link, error) 30 | Delete(container *Link) error 31 | } 32 | 33 | func newLinkClient(rancherClient *RancherClient) *LinkClient { 34 | return &LinkClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *LinkClient) Create(container *Link) (*Link, error) { 40 | resp := &Link{} 41 | err := c.rancherClient.doCreate(LINK_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *LinkClient) Update(existing *Link, updates interface{}) (*Link, error) { 46 | resp := &Link{} 47 | err := c.rancherClient.doUpdate(LINK_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *LinkClient) List(opts *ListOpts) (*LinkCollection, error) { 52 | resp := &LinkCollection{} 53 | err := c.rancherClient.doList(LINK_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *LinkCollection) Next() (*LinkCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &LinkCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *LinkClient) ById(id string) (*Link, error) { 69 | resp := &Link{} 70 | err := c.rancherClient.doById(LINK_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *LinkClient) Delete(container *Link) error { 80 | return c.rancherClient.doResourceDelete(LINK_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_log_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | LOG_CONFIG_TYPE = "logConfig" 5 | ) 6 | 7 | type LogConfig struct { 8 | Resource 9 | 10 | Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"` 11 | 12 | Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` 13 | } 14 | 15 | type LogConfigCollection struct { 16 | Collection 17 | Data []LogConfig `json:"data,omitempty"` 18 | client *LogConfigClient 19 | } 20 | 21 | type LogConfigClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type LogConfigOperations interface { 26 | List(opts *ListOpts) (*LogConfigCollection, error) 27 | Create(opts *LogConfig) (*LogConfig, error) 28 | Update(existing *LogConfig, updates interface{}) (*LogConfig, error) 29 | ById(id string) (*LogConfig, error) 30 | Delete(container *LogConfig) error 31 | } 32 | 33 | func newLogConfigClient(rancherClient *RancherClient) *LogConfigClient { 34 | return &LogConfigClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *LogConfigClient) Create(container *LogConfig) (*LogConfig, error) { 40 | resp := &LogConfig{} 41 | err := c.rancherClient.doCreate(LOG_CONFIG_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *LogConfigClient) Update(existing *LogConfig, updates interface{}) (*LogConfig, error) { 46 | resp := &LogConfig{} 47 | err := c.rancherClient.doUpdate(LOG_CONFIG_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *LogConfigClient) List(opts *ListOpts) (*LogConfigCollection, error) { 52 | resp := &LogConfigCollection{} 53 | err := c.rancherClient.doList(LOG_CONFIG_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *LogConfigCollection) Next() (*LogConfigCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &LogConfigCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *LogConfigClient) ById(id string) (*LogConfig, error) { 69 | resp := &LogConfig{} 70 | err := c.rancherClient.doById(LOG_CONFIG_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *LogConfigClient) Delete(container *LogConfig) error { 80 | return c.rancherClient.doResourceDelete(LOG_CONFIG_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_mount_entry.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | MOUNT_ENTRY_TYPE = "mountEntry" 5 | ) 6 | 7 | type MountEntry struct { 8 | Resource 9 | 10 | InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` 11 | 12 | InstanceName string `json:"instanceName,omitempty" yaml:"instance_name,omitempty"` 13 | 14 | Path string `json:"path,omitempty" yaml:"path,omitempty"` 15 | 16 | VolumeId string `json:"volumeId,omitempty" yaml:"volume_id,omitempty"` 17 | 18 | VolumeName string `json:"volumeName,omitempty" yaml:"volume_name,omitempty"` 19 | } 20 | 21 | type MountEntryCollection struct { 22 | Collection 23 | Data []MountEntry `json:"data,omitempty"` 24 | client *MountEntryClient 25 | } 26 | 27 | type MountEntryClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type MountEntryOperations interface { 32 | List(opts *ListOpts) (*MountEntryCollection, error) 33 | Create(opts *MountEntry) (*MountEntry, error) 34 | Update(existing *MountEntry, updates interface{}) (*MountEntry, error) 35 | ById(id string) (*MountEntry, error) 36 | Delete(container *MountEntry) error 37 | } 38 | 39 | func newMountEntryClient(rancherClient *RancherClient) *MountEntryClient { 40 | return &MountEntryClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *MountEntryClient) Create(container *MountEntry) (*MountEntry, error) { 46 | resp := &MountEntry{} 47 | err := c.rancherClient.doCreate(MOUNT_ENTRY_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *MountEntryClient) Update(existing *MountEntry, updates interface{}) (*MountEntry, error) { 52 | resp := &MountEntry{} 53 | err := c.rancherClient.doUpdate(MOUNT_ENTRY_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *MountEntryClient) List(opts *ListOpts) (*MountEntryCollection, error) { 58 | resp := &MountEntryCollection{} 59 | err := c.rancherClient.doList(MOUNT_ENTRY_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *MountEntryCollection) Next() (*MountEntryCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &MountEntryCollection{} 67 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 68 | resp.client = cc.client 69 | return resp, err 70 | } 71 | return nil, nil 72 | } 73 | 74 | func (c *MountEntryClient) ById(id string) (*MountEntry, error) { 75 | resp := &MountEntry{} 76 | err := c.rancherClient.doById(MOUNT_ENTRY_TYPE, id, resp) 77 | if apiError, ok := err.(*ApiError); ok { 78 | if apiError.StatusCode == 404 { 79 | return nil, nil 80 | } 81 | } 82 | return resp, err 83 | } 84 | 85 | func (c *MountEntryClient) Delete(container *MountEntry) error { 86 | return c.rancherClient.doResourceDelete(MOUNT_ENTRY_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_restart_policy.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | RESTART_POLICY_TYPE = "restartPolicy" 5 | ) 6 | 7 | type RestartPolicy struct { 8 | Resource 9 | 10 | MaximumRetryCount int64 `json:"maximumRetryCount,omitempty" yaml:"maximum_retry_count,omitempty"` 11 | 12 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 13 | } 14 | 15 | type RestartPolicyCollection struct { 16 | Collection 17 | Data []RestartPolicy `json:"data,omitempty"` 18 | client *RestartPolicyClient 19 | } 20 | 21 | type RestartPolicyClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type RestartPolicyOperations interface { 26 | List(opts *ListOpts) (*RestartPolicyCollection, error) 27 | Create(opts *RestartPolicy) (*RestartPolicy, error) 28 | Update(existing *RestartPolicy, updates interface{}) (*RestartPolicy, error) 29 | ById(id string) (*RestartPolicy, error) 30 | Delete(container *RestartPolicy) error 31 | } 32 | 33 | func newRestartPolicyClient(rancherClient *RancherClient) *RestartPolicyClient { 34 | return &RestartPolicyClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *RestartPolicyClient) Create(container *RestartPolicy) (*RestartPolicy, error) { 40 | resp := &RestartPolicy{} 41 | err := c.rancherClient.doCreate(RESTART_POLICY_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *RestartPolicyClient) Update(existing *RestartPolicy, updates interface{}) (*RestartPolicy, error) { 46 | resp := &RestartPolicy{} 47 | err := c.rancherClient.doUpdate(RESTART_POLICY_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *RestartPolicyClient) List(opts *ListOpts) (*RestartPolicyCollection, error) { 52 | resp := &RestartPolicyCollection{} 53 | err := c.rancherClient.doList(RESTART_POLICY_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *RestartPolicyCollection) Next() (*RestartPolicyCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &RestartPolicyCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *RestartPolicyClient) ById(id string) (*RestartPolicy, error) { 69 | resp := &RestartPolicy{} 70 | err := c.rancherClient.doById(RESTART_POLICY_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *RestartPolicyClient) Delete(container *RestartPolicy) error { 80 | return c.rancherClient.doResourceDelete(RESTART_POLICY_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_service_proxy.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_PROXY_TYPE = "serviceProxy" 5 | ) 6 | 7 | type ServiceProxy struct { 8 | Resource 9 | 10 | Port int64 `json:"port,omitempty" yaml:"port,omitempty"` 11 | 12 | Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` 13 | 14 | Service string `json:"service,omitempty" yaml:"service,omitempty"` 15 | 16 | Token string `json:"token,omitempty" yaml:"token,omitempty"` 17 | 18 | Url string `json:"url,omitempty" yaml:"url,omitempty"` 19 | } 20 | 21 | type ServiceProxyCollection struct { 22 | Collection 23 | Data []ServiceProxy `json:"data,omitempty"` 24 | client *ServiceProxyClient 25 | } 26 | 27 | type ServiceProxyClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type ServiceProxyOperations interface { 32 | List(opts *ListOpts) (*ServiceProxyCollection, error) 33 | Create(opts *ServiceProxy) (*ServiceProxy, error) 34 | Update(existing *ServiceProxy, updates interface{}) (*ServiceProxy, error) 35 | ById(id string) (*ServiceProxy, error) 36 | Delete(container *ServiceProxy) error 37 | } 38 | 39 | func newServiceProxyClient(rancherClient *RancherClient) *ServiceProxyClient { 40 | return &ServiceProxyClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *ServiceProxyClient) Create(container *ServiceProxy) (*ServiceProxy, error) { 46 | resp := &ServiceProxy{} 47 | err := c.rancherClient.doCreate(SERVICE_PROXY_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ServiceProxyClient) Update(existing *ServiceProxy, updates interface{}) (*ServiceProxy, error) { 52 | resp := &ServiceProxy{} 53 | err := c.rancherClient.doUpdate(SERVICE_PROXY_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *ServiceProxyClient) List(opts *ListOpts) (*ServiceProxyCollection, error) { 58 | resp := &ServiceProxyCollection{} 59 | err := c.rancherClient.doList(SERVICE_PROXY_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *ServiceProxyCollection) Next() (*ServiceProxyCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &ServiceProxyCollection{} 67 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 68 | resp.client = cc.client 69 | return resp, err 70 | } 71 | return nil, nil 72 | } 73 | 74 | func (c *ServiceProxyClient) ById(id string) (*ServiceProxy, error) { 75 | resp := &ServiceProxy{} 76 | err := c.rancherClient.doById(SERVICE_PROXY_TYPE, id, resp) 77 | if apiError, ok := err.(*ApiError); ok { 78 | if apiError.StatusCode == 404 { 79 | return nil, nil 80 | } 81 | } 82 | return resp, err 83 | } 84 | 85 | func (c *ServiceProxyClient) Delete(container *ServiceProxy) error { 86 | return c.rancherClient.doResourceDelete(SERVICE_PROXY_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_service_rollback.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_ROLLBACK_TYPE = "serviceRollback" 5 | ) 6 | 7 | type ServiceRollback struct { 8 | Resource 9 | 10 | RevisionId string `json:"revisionId,omitempty" yaml:"revision_id,omitempty"` 11 | } 12 | 13 | type ServiceRollbackCollection struct { 14 | Collection 15 | Data []ServiceRollback `json:"data,omitempty"` 16 | client *ServiceRollbackClient 17 | } 18 | 19 | type ServiceRollbackClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ServiceRollbackOperations interface { 24 | List(opts *ListOpts) (*ServiceRollbackCollection, error) 25 | Create(opts *ServiceRollback) (*ServiceRollback, error) 26 | Update(existing *ServiceRollback, updates interface{}) (*ServiceRollback, error) 27 | ById(id string) (*ServiceRollback, error) 28 | Delete(container *ServiceRollback) error 29 | } 30 | 31 | func newServiceRollbackClient(rancherClient *RancherClient) *ServiceRollbackClient { 32 | return &ServiceRollbackClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ServiceRollbackClient) Create(container *ServiceRollback) (*ServiceRollback, error) { 38 | resp := &ServiceRollback{} 39 | err := c.rancherClient.doCreate(SERVICE_ROLLBACK_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ServiceRollbackClient) Update(existing *ServiceRollback, updates interface{}) (*ServiceRollback, error) { 44 | resp := &ServiceRollback{} 45 | err := c.rancherClient.doUpdate(SERVICE_ROLLBACK_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ServiceRollbackClient) List(opts *ListOpts) (*ServiceRollbackCollection, error) { 50 | resp := &ServiceRollbackCollection{} 51 | err := c.rancherClient.doList(SERVICE_ROLLBACK_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ServiceRollbackCollection) Next() (*ServiceRollbackCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ServiceRollbackCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *ServiceRollbackClient) ById(id string) (*ServiceRollback, error) { 67 | resp := &ServiceRollback{} 68 | err := c.rancherClient.doById(SERVICE_ROLLBACK_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *ServiceRollbackClient) Delete(container *ServiceRollback) error { 78 | return c.rancherClient.doResourceDelete(SERVICE_ROLLBACK_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_service_upgrade.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_UPGRADE_TYPE = "serviceUpgrade" 5 | ) 6 | 7 | type ServiceUpgrade struct { 8 | Resource 9 | 10 | InServiceStrategy *InServiceUpgradeStrategy `json:"inServiceStrategy,omitempty" yaml:"in_service_strategy,omitempty"` 11 | } 12 | 13 | type ServiceUpgradeCollection struct { 14 | Collection 15 | Data []ServiceUpgrade `json:"data,omitempty"` 16 | client *ServiceUpgradeClient 17 | } 18 | 19 | type ServiceUpgradeClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ServiceUpgradeOperations interface { 24 | List(opts *ListOpts) (*ServiceUpgradeCollection, error) 25 | Create(opts *ServiceUpgrade) (*ServiceUpgrade, error) 26 | Update(existing *ServiceUpgrade, updates interface{}) (*ServiceUpgrade, error) 27 | ById(id string) (*ServiceUpgrade, error) 28 | Delete(container *ServiceUpgrade) error 29 | } 30 | 31 | func newServiceUpgradeClient(rancherClient *RancherClient) *ServiceUpgradeClient { 32 | return &ServiceUpgradeClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ServiceUpgradeClient) Create(container *ServiceUpgrade) (*ServiceUpgrade, error) { 38 | resp := &ServiceUpgrade{} 39 | err := c.rancherClient.doCreate(SERVICE_UPGRADE_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ServiceUpgradeClient) Update(existing *ServiceUpgrade, updates interface{}) (*ServiceUpgrade, error) { 44 | resp := &ServiceUpgrade{} 45 | err := c.rancherClient.doUpdate(SERVICE_UPGRADE_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ServiceUpgradeClient) List(opts *ListOpts) (*ServiceUpgradeCollection, error) { 50 | resp := &ServiceUpgradeCollection{} 51 | err := c.rancherClient.doList(SERVICE_UPGRADE_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ServiceUpgradeCollection) Next() (*ServiceUpgradeCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ServiceUpgradeCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *ServiceUpgradeClient) ById(id string) (*ServiceUpgrade, error) { 67 | resp := &ServiceUpgrade{} 68 | err := c.rancherClient.doById(SERVICE_UPGRADE_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *ServiceUpgradeClient) Delete(container *ServiceUpgrade) error { 78 | return c.rancherClient.doResourceDelete(SERVICE_UPGRADE_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_setting.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SETTING_TYPE = "setting" 5 | ) 6 | 7 | type Setting struct { 8 | Resource 9 | 10 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 11 | 12 | Value string `json:"value,omitempty" yaml:"value,omitempty"` 13 | } 14 | 15 | type SettingCollection struct { 16 | Collection 17 | Data []Setting `json:"data,omitempty"` 18 | client *SettingClient 19 | } 20 | 21 | type SettingClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type SettingOperations interface { 26 | List(opts *ListOpts) (*SettingCollection, error) 27 | Create(opts *Setting) (*Setting, error) 28 | Update(existing *Setting, updates interface{}) (*Setting, error) 29 | ById(id string) (*Setting, error) 30 | Delete(container *Setting) error 31 | } 32 | 33 | func newSettingClient(rancherClient *RancherClient) *SettingClient { 34 | return &SettingClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *SettingClient) Create(container *Setting) (*Setting, error) { 40 | resp := &Setting{} 41 | err := c.rancherClient.doCreate(SETTING_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *SettingClient) Update(existing *Setting, updates interface{}) (*Setting, error) { 46 | resp := &Setting{} 47 | err := c.rancherClient.doUpdate(SETTING_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *SettingClient) List(opts *ListOpts) (*SettingCollection, error) { 52 | resp := &SettingCollection{} 53 | err := c.rancherClient.doList(SETTING_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *SettingCollection) Next() (*SettingCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &SettingCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *SettingClient) ById(id string) (*Setting, error) { 69 | resp := &Setting{} 70 | err := c.rancherClient.doById(SETTING_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *SettingClient) Delete(container *Setting) error { 80 | return c.rancherClient.doResourceDelete(SETTING_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_stack_info.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STACK_INFO_TYPE = "stackInfo" 5 | ) 6 | 7 | type StackInfo struct { 8 | Resource 9 | 10 | EnvironmentUuid string `json:"environmentUuid,omitempty" yaml:"environment_uuid,omitempty"` 11 | 12 | HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` 13 | 14 | InfoType string `json:"infoType,omitempty" yaml:"info_type,omitempty"` 15 | 16 | InfoTypeId string `json:"infoTypeId,omitempty" yaml:"info_type_id,omitempty"` 17 | 18 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 19 | 20 | Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` 21 | } 22 | 23 | type StackInfoCollection struct { 24 | Collection 25 | Data []StackInfo `json:"data,omitempty"` 26 | client *StackInfoClient 27 | } 28 | 29 | type StackInfoClient struct { 30 | rancherClient *RancherClient 31 | } 32 | 33 | type StackInfoOperations interface { 34 | List(opts *ListOpts) (*StackInfoCollection, error) 35 | Create(opts *StackInfo) (*StackInfo, error) 36 | Update(existing *StackInfo, updates interface{}) (*StackInfo, error) 37 | ById(id string) (*StackInfo, error) 38 | Delete(container *StackInfo) error 39 | } 40 | 41 | func newStackInfoClient(rancherClient *RancherClient) *StackInfoClient { 42 | return &StackInfoClient{ 43 | rancherClient: rancherClient, 44 | } 45 | } 46 | 47 | func (c *StackInfoClient) Create(container *StackInfo) (*StackInfo, error) { 48 | resp := &StackInfo{} 49 | err := c.rancherClient.doCreate(STACK_INFO_TYPE, container, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *StackInfoClient) Update(existing *StackInfo, updates interface{}) (*StackInfo, error) { 54 | resp := &StackInfo{} 55 | err := c.rancherClient.doUpdate(STACK_INFO_TYPE, &existing.Resource, updates, resp) 56 | return resp, err 57 | } 58 | 59 | func (c *StackInfoClient) List(opts *ListOpts) (*StackInfoCollection, error) { 60 | resp := &StackInfoCollection{} 61 | err := c.rancherClient.doList(STACK_INFO_TYPE, opts, resp) 62 | resp.client = c 63 | return resp, err 64 | } 65 | 66 | func (cc *StackInfoCollection) Next() (*StackInfoCollection, error) { 67 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 68 | resp := &StackInfoCollection{} 69 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 70 | resp.client = cc.client 71 | return resp, err 72 | } 73 | return nil, nil 74 | } 75 | 76 | func (c *StackInfoClient) ById(id string) (*StackInfo, error) { 77 | resp := &StackInfo{} 78 | err := c.rancherClient.doById(STACK_INFO_TYPE, id, resp) 79 | if apiError, ok := err.(*ApiError); ok { 80 | if apiError.StatusCode == 404 { 81 | return nil, nil 82 | } 83 | } 84 | return resp, err 85 | } 86 | 87 | func (c *StackInfoClient) Delete(container *StackInfo) error { 88 | return c.rancherClient.doResourceDelete(STACK_INFO_TYPE, &container.Resource) 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_stack_upgrade.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STACK_UPGRADE_TYPE = "stackUpgrade" 5 | ) 6 | 7 | type StackUpgrade struct { 8 | Resource 9 | } 10 | 11 | type StackUpgradeCollection struct { 12 | Collection 13 | Data []StackUpgrade `json:"data,omitempty"` 14 | client *StackUpgradeClient 15 | } 16 | 17 | type StackUpgradeClient struct { 18 | rancherClient *RancherClient 19 | } 20 | 21 | type StackUpgradeOperations interface { 22 | List(opts *ListOpts) (*StackUpgradeCollection, error) 23 | Create(opts *StackUpgrade) (*StackUpgrade, error) 24 | Update(existing *StackUpgrade, updates interface{}) (*StackUpgrade, error) 25 | ById(id string) (*StackUpgrade, error) 26 | Delete(container *StackUpgrade) error 27 | } 28 | 29 | func newStackUpgradeClient(rancherClient *RancherClient) *StackUpgradeClient { 30 | return &StackUpgradeClient{ 31 | rancherClient: rancherClient, 32 | } 33 | } 34 | 35 | func (c *StackUpgradeClient) Create(container *StackUpgrade) (*StackUpgrade, error) { 36 | resp := &StackUpgrade{} 37 | err := c.rancherClient.doCreate(STACK_UPGRADE_TYPE, container, resp) 38 | return resp, err 39 | } 40 | 41 | func (c *StackUpgradeClient) Update(existing *StackUpgrade, updates interface{}) (*StackUpgrade, error) { 42 | resp := &StackUpgrade{} 43 | err := c.rancherClient.doUpdate(STACK_UPGRADE_TYPE, &existing.Resource, updates, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *StackUpgradeClient) List(opts *ListOpts) (*StackUpgradeCollection, error) { 48 | resp := &StackUpgradeCollection{} 49 | err := c.rancherClient.doList(STACK_UPGRADE_TYPE, opts, resp) 50 | resp.client = c 51 | return resp, err 52 | } 53 | 54 | func (cc *StackUpgradeCollection) Next() (*StackUpgradeCollection, error) { 55 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 56 | resp := &StackUpgradeCollection{} 57 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 58 | resp.client = cc.client 59 | return resp, err 60 | } 61 | return nil, nil 62 | } 63 | 64 | func (c *StackUpgradeClient) ById(id string) (*StackUpgrade, error) { 65 | resp := &StackUpgrade{} 66 | err := c.rancherClient.doById(STACK_UPGRADE_TYPE, id, resp) 67 | if apiError, ok := err.(*ApiError); ok { 68 | if apiError.StatusCode == 404 { 69 | return nil, nil 70 | } 71 | } 72 | return resp, err 73 | } 74 | 75 | func (c *StackUpgradeClient) Delete(container *StackUpgrade) error { 76 | return c.rancherClient.doResourceDelete(STACK_UPGRADE_TYPE, &container.Resource) 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_stats_access.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STATS_ACCESS_TYPE = "statsAccess" 5 | ) 6 | 7 | type StatsAccess struct { 8 | Resource 9 | 10 | AuthToken string `json:"authToken,omitempty" yaml:"auth_token,omitempty"` 11 | 12 | Token string `json:"token,omitempty" yaml:"token,omitempty"` 13 | 14 | Url string `json:"url,omitempty" yaml:"url,omitempty"` 15 | } 16 | 17 | type StatsAccessCollection struct { 18 | Collection 19 | Data []StatsAccess `json:"data,omitempty"` 20 | client *StatsAccessClient 21 | } 22 | 23 | type StatsAccessClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type StatsAccessOperations interface { 28 | List(opts *ListOpts) (*StatsAccessCollection, error) 29 | Create(opts *StatsAccess) (*StatsAccess, error) 30 | Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) 31 | ById(id string) (*StatsAccess, error) 32 | Delete(container *StatsAccess) error 33 | } 34 | 35 | func newStatsAccessClient(rancherClient *RancherClient) *StatsAccessClient { 36 | return &StatsAccessClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *StatsAccessClient) Create(container *StatsAccess) (*StatsAccess, error) { 42 | resp := &StatsAccess{} 43 | err := c.rancherClient.doCreate(STATS_ACCESS_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *StatsAccessClient) Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) { 48 | resp := &StatsAccess{} 49 | err := c.rancherClient.doUpdate(STATS_ACCESS_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *StatsAccessClient) List(opts *ListOpts) (*StatsAccessCollection, error) { 54 | resp := &StatsAccessCollection{} 55 | err := c.rancherClient.doList(STATS_ACCESS_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *StatsAccessCollection) Next() (*StatsAccessCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &StatsAccessCollection{} 63 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 64 | resp.client = cc.client 65 | return resp, err 66 | } 67 | return nil, nil 68 | } 69 | 70 | func (c *StatsAccessClient) ById(id string) (*StatsAccess, error) { 71 | resp := &StatsAccess{} 72 | err := c.rancherClient.doById(STATS_ACCESS_TYPE, id, resp) 73 | if apiError, ok := err.(*ApiError); ok { 74 | if apiError.StatusCode == 404 { 75 | return nil, nil 76 | } 77 | } 78 | return resp, err 79 | } 80 | 81 | func (c *StatsAccessClient) Delete(container *StatsAccess) error { 82 | return c.rancherClient.doResourceDelete(STATS_ACCESS_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_subscribe.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SUBSCRIBE_TYPE = "subscribe" 5 | ) 6 | 7 | type Subscribe struct { 8 | Resource 9 | 10 | AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` 11 | 12 | EventNames []string `json:"eventNames,omitempty" yaml:"event_names,omitempty"` 13 | } 14 | 15 | type SubscribeCollection struct { 16 | Collection 17 | Data []Subscribe `json:"data,omitempty"` 18 | client *SubscribeClient 19 | } 20 | 21 | type SubscribeClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type SubscribeOperations interface { 26 | List(opts *ListOpts) (*SubscribeCollection, error) 27 | Create(opts *Subscribe) (*Subscribe, error) 28 | Update(existing *Subscribe, updates interface{}) (*Subscribe, error) 29 | ById(id string) (*Subscribe, error) 30 | Delete(container *Subscribe) error 31 | } 32 | 33 | func newSubscribeClient(rancherClient *RancherClient) *SubscribeClient { 34 | return &SubscribeClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *SubscribeClient) Create(container *Subscribe) (*Subscribe, error) { 40 | resp := &Subscribe{} 41 | err := c.rancherClient.doCreate(SUBSCRIBE_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *SubscribeClient) Update(existing *Subscribe, updates interface{}) (*Subscribe, error) { 46 | resp := &Subscribe{} 47 | err := c.rancherClient.doUpdate(SUBSCRIBE_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *SubscribeClient) List(opts *ListOpts) (*SubscribeCollection, error) { 52 | resp := &SubscribeCollection{} 53 | err := c.rancherClient.doList(SUBSCRIBE_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *SubscribeCollection) Next() (*SubscribeCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &SubscribeCollection{} 61 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 62 | resp.client = cc.client 63 | return resp, err 64 | } 65 | return nil, nil 66 | } 67 | 68 | func (c *SubscribeClient) ById(id string) (*Subscribe, error) { 69 | resp := &Subscribe{} 70 | err := c.rancherClient.doById(SUBSCRIBE_TYPE, id, resp) 71 | if apiError, ok := err.(*ApiError); ok { 72 | if apiError.StatusCode == 404 { 73 | return nil, nil 74 | } 75 | } 76 | return resp, err 77 | } 78 | 79 | func (c *SubscribeClient) Delete(container *Subscribe) error { 80 | return c.rancherClient.doResourceDelete(SUBSCRIBE_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_ulimit.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | ULIMIT_TYPE = "ulimit" 5 | ) 6 | 7 | type Ulimit struct { 8 | Resource 9 | 10 | Hard int64 `json:"hard,omitempty" yaml:"hard,omitempty"` 11 | 12 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 13 | 14 | Soft int64 `json:"soft,omitempty" yaml:"soft,omitempty"` 15 | } 16 | 17 | type UlimitCollection struct { 18 | Collection 19 | Data []Ulimit `json:"data,omitempty"` 20 | client *UlimitClient 21 | } 22 | 23 | type UlimitClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type UlimitOperations interface { 28 | List(opts *ListOpts) (*UlimitCollection, error) 29 | Create(opts *Ulimit) (*Ulimit, error) 30 | Update(existing *Ulimit, updates interface{}) (*Ulimit, error) 31 | ById(id string) (*Ulimit, error) 32 | Delete(container *Ulimit) error 33 | } 34 | 35 | func newUlimitClient(rancherClient *RancherClient) *UlimitClient { 36 | return &UlimitClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *UlimitClient) Create(container *Ulimit) (*Ulimit, error) { 42 | resp := &Ulimit{} 43 | err := c.rancherClient.doCreate(ULIMIT_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *UlimitClient) Update(existing *Ulimit, updates interface{}) (*Ulimit, error) { 48 | resp := &Ulimit{} 49 | err := c.rancherClient.doUpdate(ULIMIT_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *UlimitClient) List(opts *ListOpts) (*UlimitCollection, error) { 54 | resp := &UlimitCollection{} 55 | err := c.rancherClient.doList(ULIMIT_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *UlimitCollection) Next() (*UlimitCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &UlimitCollection{} 63 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 64 | resp.client = cc.client 65 | return resp, err 66 | } 67 | return nil, nil 68 | } 69 | 70 | func (c *UlimitClient) ById(id string) (*Ulimit, error) { 71 | resp := &Ulimit{} 72 | err := c.rancherClient.doById(ULIMIT_TYPE, id, resp) 73 | if apiError, ok := err.(*ApiError); ok { 74 | if apiError.StatusCode == 404 { 75 | return nil, nil 76 | } 77 | } 78 | return resp, err 79 | } 80 | 81 | func (c *UlimitClient) Delete(container *Ulimit) error { 82 | return c.rancherClient.doResourceDelete(ULIMIT_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/rancher/go-rancher/v3/generated_volume_activate_input.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | VOLUME_ACTIVATE_INPUT_TYPE = "volumeActivateInput" 5 | ) 6 | 7 | type VolumeActivateInput struct { 8 | Resource 9 | 10 | HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` 11 | } 12 | 13 | type VolumeActivateInputCollection struct { 14 | Collection 15 | Data []VolumeActivateInput `json:"data,omitempty"` 16 | client *VolumeActivateInputClient 17 | } 18 | 19 | type VolumeActivateInputClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type VolumeActivateInputOperations interface { 24 | List(opts *ListOpts) (*VolumeActivateInputCollection, error) 25 | Create(opts *VolumeActivateInput) (*VolumeActivateInput, error) 26 | Update(existing *VolumeActivateInput, updates interface{}) (*VolumeActivateInput, error) 27 | ById(id string) (*VolumeActivateInput, error) 28 | Delete(container *VolumeActivateInput) error 29 | } 30 | 31 | func newVolumeActivateInputClient(rancherClient *RancherClient) *VolumeActivateInputClient { 32 | return &VolumeActivateInputClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *VolumeActivateInputClient) Create(container *VolumeActivateInput) (*VolumeActivateInput, error) { 38 | resp := &VolumeActivateInput{} 39 | err := c.rancherClient.doCreate(VOLUME_ACTIVATE_INPUT_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *VolumeActivateInputClient) Update(existing *VolumeActivateInput, updates interface{}) (*VolumeActivateInput, error) { 44 | resp := &VolumeActivateInput{} 45 | err := c.rancherClient.doUpdate(VOLUME_ACTIVATE_INPUT_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *VolumeActivateInputClient) List(opts *ListOpts) (*VolumeActivateInputCollection, error) { 50 | resp := &VolumeActivateInputCollection{} 51 | err := c.rancherClient.doList(VOLUME_ACTIVATE_INPUT_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *VolumeActivateInputCollection) Next() (*VolumeActivateInputCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &VolumeActivateInputCollection{} 59 | err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) 60 | resp.client = cc.client 61 | return resp, err 62 | } 63 | return nil, nil 64 | } 65 | 66 | func (c *VolumeActivateInputClient) ById(id string) (*VolumeActivateInput, error) { 67 | resp := &VolumeActivateInput{} 68 | err := c.rancherClient.doById(VOLUME_ACTIVATE_INPUT_TYPE, id, resp) 69 | if apiError, ok := err.(*ApiError); ok { 70 | if apiError.StatusCode == 404 { 71 | return nil, nil 72 | } 73 | } 74 | return resp, err 75 | } 76 | 77 | func (c *VolumeActivateInputClient) Delete(container *VolumeActivateInput) error { 78 | return c.rancherClient.doResourceDelete(VOLUME_ACTIVATE_INPUT_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/gopkg.in/check.v1/.gitignore: -------------------------------------------------------------------------------- 1 | _* 2 | *.swp 3 | *.[568] 4 | [568].out 5 | -------------------------------------------------------------------------------- /vendor/gopkg.in/check.v1/LICENSE: -------------------------------------------------------------------------------- 1 | Gocheck - A rich testing framework for Go 2 | 3 | Copyright (c) 2010-2013 Gustavo Niemeyer 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/check.v1/README.md: -------------------------------------------------------------------------------- 1 | Instructions 2 | ============ 3 | 4 | Install the package with: 5 | 6 | go get gopkg.in/check.v1 7 | 8 | Import it with: 9 | 10 | import "gopkg.in/check.v1" 11 | 12 | and use _check_ as the package name inside the code. 13 | 14 | For more details, visit the project page: 15 | 16 | * http://labix.org/gocheck 17 | 18 | and the API documentation: 19 | 20 | * https://gopkg.in/check.v1 21 | -------------------------------------------------------------------------------- /vendor/gopkg.in/check.v1/TODO: -------------------------------------------------------------------------------- 1 | - Assert(slice, Contains, item) 2 | - Parallel test support 3 | -------------------------------------------------------------------------------- /vendor/gopkg.in/check.v1/reporter.go: -------------------------------------------------------------------------------- 1 | package check 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "sync" 7 | ) 8 | 9 | // ----------------------------------------------------------------------- 10 | // Output writer manages atomic output writing according to settings. 11 | 12 | type outputWriter struct { 13 | m sync.Mutex 14 | writer io.Writer 15 | wroteCallProblemLast bool 16 | Stream bool 17 | Verbose bool 18 | } 19 | 20 | func newOutputWriter(writer io.Writer, stream, verbose bool) *outputWriter { 21 | return &outputWriter{writer: writer, Stream: stream, Verbose: verbose} 22 | } 23 | 24 | func (ow *outputWriter) Write(content []byte) (n int, err error) { 25 | ow.m.Lock() 26 | n, err = ow.writer.Write(content) 27 | ow.m.Unlock() 28 | return 29 | } 30 | 31 | func (ow *outputWriter) WriteCallStarted(label string, c *C) { 32 | if ow.Stream { 33 | header := renderCallHeader(label, c, "", "\n") 34 | ow.m.Lock() 35 | ow.writer.Write([]byte(header)) 36 | ow.m.Unlock() 37 | } 38 | } 39 | 40 | func (ow *outputWriter) WriteCallProblem(label string, c *C) { 41 | var prefix string 42 | if !ow.Stream { 43 | prefix = "\n-----------------------------------" + 44 | "-----------------------------------\n" 45 | } 46 | header := renderCallHeader(label, c, prefix, "\n\n") 47 | ow.m.Lock() 48 | ow.wroteCallProblemLast = true 49 | ow.writer.Write([]byte(header)) 50 | if !ow.Stream { 51 | c.logb.WriteTo(ow.writer) 52 | } 53 | ow.m.Unlock() 54 | } 55 | 56 | func (ow *outputWriter) WriteCallSuccess(label string, c *C) { 57 | if ow.Stream || (ow.Verbose && c.kind == testKd) { 58 | // TODO Use a buffer here. 59 | var suffix string 60 | if c.reason != "" { 61 | suffix = " (" + c.reason + ")" 62 | } 63 | if c.status() == succeededSt { 64 | suffix += "\t" + c.timerString() 65 | } 66 | suffix += "\n" 67 | if ow.Stream { 68 | suffix += "\n" 69 | } 70 | header := renderCallHeader(label, c, "", suffix) 71 | ow.m.Lock() 72 | // Resist temptation of using line as prefix above due to race. 73 | if !ow.Stream && ow.wroteCallProblemLast { 74 | header = "\n-----------------------------------" + 75 | "-----------------------------------\n" + 76 | header 77 | } 78 | ow.wroteCallProblemLast = false 79 | ow.writer.Write([]byte(header)) 80 | ow.m.Unlock() 81 | } 82 | } 83 | 84 | func renderCallHeader(label string, c *C, prefix, suffix string) string { 85 | pc := c.method.PC() 86 | return fmt.Sprintf("%s%s: %s: %s%s", prefix, label, niceFuncPath(pc), 87 | niceFuncName(pc), suffix) 88 | } 89 | --------------------------------------------------------------------------------