├── .dockerignore ├── .drone.yml ├── .gitignore ├── Dockerfile.dapper ├── LICENSE ├── Makefile ├── README.md ├── api ├── api.go ├── context.go ├── handler.go ├── html_writer.go ├── json_writer.go ├── url.go └── writer.go ├── catalog ├── client.go ├── common.go ├── generated_api_version.go ├── generated_catalog.go ├── generated_client.go ├── generated_error.go ├── generated_question.go ├── generated_template.go ├── generated_template_version.go ├── schemas.go └── types.go ├── client ├── client.go ├── common.go ├── generated_account.go ├── generated_active_setting.go ├── generated_add_outputs_input.go ├── generated_add_remove_load_balancer_service_link_input.go ├── generated_add_remove_service_link_input.go ├── generated_agent.go ├── generated_amazonec2config.go ├── generated_api_key.go ├── generated_audit_log.go ├── generated_azure_config.go ├── generated_azureadconfig.go ├── generated_backup.go ├── generated_backup_target.go ├── generated_base_machine_config.go ├── generated_blkio_device_option.go ├── generated_certificate.go ├── generated_change_secret_input.go ├── generated_client.go ├── generated_compose_config.go ├── generated_compose_config_input.go ├── generated_compose_project.go ├── generated_compose_service.go ├── generated_config_item.go ├── generated_config_item_status.go ├── generated_container.go ├── generated_container_event.go ├── generated_container_exec.go ├── generated_container_logs.go ├── generated_container_proxy.go ├── generated_credential.go ├── generated_databasechangelog.go ├── generated_databasechangeloglock.go ├── generated_digitalocean_config.go ├── generated_dns_service.go ├── generated_docker_build.go ├── generated_dynamic_schema.go ├── generated_environment.go ├── generated_environment_upgrade.go ├── generated_extension_implementation.go ├── generated_extension_point.go ├── generated_external_dns_event.go ├── generated_external_event.go ├── generated_external_handler.go ├── generated_external_handler_external_handler_process_map.go ├── generated_external_handler_process.go ├── generated_external_handler_process_config.go ├── generated_external_host_event.go ├── generated_external_service.go ├── generated_external_service_event.go ├── generated_external_storage_pool_event.go ├── generated_external_volume_event.go ├── generated_field_documentation.go ├── generated_githubconfig.go ├── generated_ha_config.go ├── generated_ha_config_input.go ├── generated_haproxy_config.go ├── generated_healthcheck_instance_host_map.go ├── generated_host.go ├── generated_host_access.go ├── generated_host_api_proxy_token.go ├── generated_identity.go ├── generated_image.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_link.go ├── generated_instance_stop.go ├── generated_ip_address.go ├── generated_ip_address_associate_input.go ├── generated_kubernetes_service.go ├── generated_kubernetes_stack.go ├── generated_kubernetes_stack_upgrade.go ├── generated_label.go ├── generated_launch_config.go ├── generated_ldapconfig.go ├── generated_load_balancer_app_cookie_stickiness_policy.go ├── generated_load_balancer_config.go ├── generated_load_balancer_cookie_stickiness_policy.go ├── generated_load_balancer_service.go ├── generated_load_balancer_service_link.go ├── generated_local_auth_config.go ├── generated_log_config.go ├── generated_machine.go ├── generated_machine_driver.go ├── generated_mount.go ├── generated_network.go ├── generated_nfs_config.go ├── generated_openldapconfig.go ├── generated_packet_config.go ├── generated_password.go ├── generated_physical_host.go ├── generated_port.go ├── generated_process_definition.go ├── generated_process_execution.go ├── generated_process_instance.go ├── generated_project.go ├── generated_project_member.go ├── generated_public_endpoint.go ├── generated_publish.go ├── generated_pull_task.go ├── generated_recreate_on_quorum_strategy_config.go ├── generated_register.go ├── generated_registration_token.go ├── generated_registry.go ├── generated_registry_credential.go ├── generated_resource_definition.go ├── generated_restart_policy.go ├── generated_restore_from_backup_input.go ├── generated_revert_to_snapshot_input.go ├── generated_rolling_restart_strategy.go ├── generated_scale_policy.go ├── generated_secondary_launch_config.go ├── generated_service.go ├── generated_service_consume_map.go ├── generated_service_event.go ├── generated_service_expose_map.go ├── generated_service_link.go ├── generated_service_proxy.go ├── generated_service_restart.go ├── generated_service_upgrade.go ├── generated_service_upgrade_strategy.go ├── generated_services_port_range.go ├── generated_set_labels_input.go ├── generated_set_load_balancer_service_links_input.go ├── generated_set_project_members_input.go ├── generated_set_service_links_input.go ├── generated_setting.go ├── generated_snapshot.go ├── generated_snapshot_backup_input.go ├── generated_state_transition.go ├── generated_stats_access.go ├── generated_storage_pool.go ├── generated_subscribe.go ├── generated_task.go ├── generated_task_instance.go ├── generated_to_service_upgrade_strategy.go ├── generated_type_documentation.go ├── generated_virtual_machine.go ├── generated_virtual_machine_disk.go ├── generated_volume.go ├── generated_volume_snapshot_input.go ├── schemas.go └── types.go ├── docs ├── api_common_functions.go ├── api_description_generator.go ├── api_doc_generator.go ├── input │ ├── api_description_override.yml │ ├── api_description_override_apiVersion.yml │ ├── collection_api_description.yml │ ├── collection_api_description_apiVersion.yml │ ├── common_fields.yml │ ├── generic_descriptions.yml │ ├── schema-check │ │ ├── api_description.yml │ │ ├── blacklist_actions.yml │ │ ├── blacklist_collections.yml │ │ ├── blacklist_resource_actions.yml │ │ ├── blacklist_resource_fields.yml │ │ ├── blank_api_description.yml │ │ ├── blank_collection_api_description.yml │ │ └── valid_example_api_description.yml │ ├── schemas.json │ ├── serviceExample.yml │ └── serviceJSONExample.yml ├── main.go └── templates │ ├── apiActionInput.template │ ├── apiDescription.template │ ├── apiHomePage.template │ ├── apiNavBar.template │ └── apiResource.template ├── generator ├── client.template ├── generator.go └── type.template ├── hostaccess └── instance.go ├── hostaccess_v3 └── instance.go ├── main.go ├── scripts ├── build ├── ci ├── common_functions ├── entry ├── gen-api-docs.sh ├── gen-schema.sh ├── generate-rancher-schemas.sh ├── release ├── test ├── validate └── version ├── trash.conf ├── v2 ├── client.go ├── common.go ├── generated_account.go ├── generated_active_setting.go ├── generated_add_outputs_input.go ├── generated_add_remove_service_link_input.go ├── generated_agent.go ├── generated_amazonec2config.go ├── generated_api_key.go ├── generated_audit_log.go ├── generated_azure_config.go ├── generated_azureadconfig.go ├── generated_backup.go ├── generated_backup_target.go ├── generated_base_machine_config.go ├── generated_binding.go ├── generated_blkio_device_option.go ├── generated_catalog_template.go ├── generated_certificate.go ├── generated_change_secret_input.go ├── generated_client.go ├── generated_cluster_membership.go ├── generated_compose_config.go ├── generated_compose_config_input.go ├── generated_compose_project.go ├── generated_compose_service.go ├── generated_config_item.go ├── generated_config_item_status.go ├── generated_container.go ├── generated_container_event.go ├── generated_container_exec.go ├── generated_container_logs.go ├── generated_container_proxy.go ├── generated_credential.go ├── generated_databasechangelog.go ├── generated_databasechangeloglock.go ├── generated_default_network.go ├── generated_digitalocean_config.go ├── generated_dns_service.go ├── generated_docker_build.go ├── generated_extension_implementation.go ├── generated_extension_point.go ├── generated_external_dns_event.go ├── generated_external_event.go ├── generated_external_handler.go ├── generated_external_handler_external_handler_process_map.go ├── generated_external_handler_process.go ├── generated_external_handler_process_config.go ├── generated_external_host_event.go ├── generated_external_service.go ├── generated_external_service_event.go ├── generated_external_storage_pool_event.go ├── generated_external_volume_event.go ├── generated_field_documentation.go ├── generated_generic_object.go ├── generated_ha_config.go ├── generated_ha_config_input.go ├── generated_healthcheck_instance_host_map.go ├── generated_host.go ├── generated_host_access.go ├── generated_host_api_proxy_token.go ├── generated_host_template.go ├── generated_identity.go ├── generated_image.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_link.go ├── generated_instance_stop.go ├── generated_ip_address.go ├── generated_kubernetes_service.go ├── generated_kubernetes_stack.go ├── generated_kubernetes_stack_upgrade.go ├── generated_label.go ├── generated_launch_config.go ├── generated_lb_config.go ├── generated_lb_target_config.go ├── generated_load_balancer_cookie_stickiness_policy.go ├── generated_load_balancer_service.go ├── generated_local_auth_config.go ├── generated_log_config.go ├── generated_machine.go ├── generated_machine_driver.go ├── generated_mount.go ├── generated_mount_entry.go ├── generated_network.go ├── generated_network_driver.go ├── generated_network_driver_service.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_nfs_config.go ├── generated_openldapconfig.go ├── generated_packet_config.go ├── generated_password.go ├── generated_physical_host.go ├── generated_port.go ├── generated_port_rule.go ├── generated_process_definition.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_project_template.go ├── generated_public_endpoint.go ├── generated_publish.go ├── generated_pull_task.go ├── generated_recreate_on_quorum_strategy_config.go ├── generated_register.go ├── generated_registration_token.go ├── generated_registry.go ├── generated_registry_credential.go ├── generated_resource_definition.go ├── generated_restart_policy.go ├── generated_restore_from_backup_input.go ├── generated_revert_to_snapshot_input.go ├── generated_rolling_restart_strategy.go ├── generated_scale_policy.go ├── generated_scheduled_upgrade.go ├── generated_secondary_launch_config.go ├── generated_secret.go ├── generated_secret_reference.go ├── generated_service.go ├── generated_service_binding.go ├── generated_service_consume_map.go ├── generated_service_event.go ├── generated_service_expose_map.go ├── generated_service_link.go ├── generated_service_log.go ├── generated_service_proxy.go ├── generated_service_restart.go ├── generated_service_upgrade.go ├── generated_service_upgrade_strategy.go ├── generated_services_port_range.go ├── generated_set_project_members_input.go ├── generated_set_service_links_input.go ├── generated_setting.go ├── generated_snapshot.go ├── generated_snapshot_backup_input.go ├── generated_stack.go ├── generated_stack_upgrade.go ├── generated_state_transition.go ├── generated_stats_access.go ├── generated_storage_driver.go ├── generated_storage_driver_service.go ├── generated_storage_pool.go ├── generated_subnet.go ├── generated_target_port_rule.go ├── generated_task.go ├── generated_task_instance.go ├── generated_to_service_upgrade_strategy.go ├── generated_type_documentation.go ├── generated_ulimit.go ├── generated_user_preference.go ├── generated_virtual_machine.go ├── generated_virtual_machine_disk.go ├── generated_volume.go ├── generated_volume_activate_input.go ├── generated_volume_snapshot_input.go ├── generated_volume_template.go ├── schemas.go └── types.go ├── 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_event.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_dial.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_kubernetes_service.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_secondary_launch_config.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 ├── vendor ├── github.com │ ├── Sirupsen │ │ └── logrus │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── CHANGELOG.md │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── entry.go │ │ │ ├── exported.go │ │ │ ├── formatter.go │ │ │ ├── hooks.go │ │ │ ├── json_formatter.go │ │ │ ├── logger.go │ │ │ ├── logrus.go │ │ │ ├── terminal_darwin.go │ │ │ ├── terminal_freebsd.go │ │ │ ├── terminal_linux.go │ │ │ ├── terminal_notwindows.go │ │ │ ├── terminal_openbsd.go │ │ │ ├── terminal_windows.go │ │ │ ├── text_formatter.go │ │ │ └── writer.go │ ├── gorilla │ │ ├── context │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── context.go │ │ │ └── doc.go │ │ ├── mux │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── 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 │ └── pkg │ │ └── errors │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go └── gopkg.in │ └── yaml.v2 │ ├── .travis.yml │ ├── LICENSE │ ├── LICENSE.libyaml │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── vnext ├── client.go ├── common.go ├── condition.go ├── schemas.go ├── server_types.go └── types.go /.dockerignore: -------------------------------------------------------------------------------- 1 | ./bin 2 | ./.dapper 3 | ./dist 4 | ./.trash-cache 5 | -------------------------------------------------------------------------------- /.drone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: pipeline 3 | name: default 4 | 5 | platform: 6 | os: linux 7 | arch: amd64 8 | 9 | steps: 10 | - name: build 11 | pull: default 12 | image: rancher/dapper:1.10.3 13 | commands: 14 | - dapper ci 15 | volumes: 16 | - name: socket 17 | path: /var/run/docker.sock 18 | 19 | volumes: 20 | - name: socket 21 | host: 22 | path: /var/run/docker.sock 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.dapper 2 | /bin 3 | /dist 4 | *.swp 5 | /.trash-cache 6 | -------------------------------------------------------------------------------- /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.11.1.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \ 20 | go get github.com/rancher/trash && go get golang.org/x/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 | -------------------------------------------------------------------------------- /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 | # Go Bindings for Rancher 1.x API 2 | 3 | > Looking for Rancher 2.x API bindings? [Click here](https://github.com/rancher/types) 4 | 5 | # Generating Code 6 | First, you must have a master version of Rancher running. The best way to do this is: 7 | ```sh 8 | docker run -p 8080:8080 -d rancher/server:latest 9 | ``` 10 | 11 | Once Rancher is running, you can run the gen-schema.sh script: 12 | ```sh 13 | ./scripts/gen-schema.sh http://:8080 14 | 15 | # The default url is http://localhost:8080, so if rancher/server is listening on localhost, you can omit the url: 16 | ./scripts/gen-schema.sh 17 | ``` 18 | 19 | This will add, remove, and modify go files appropriately. Submit a PR that includes *all* these changes. 20 | 21 | ## Important caveats 22 | 1. If you are running on macOS, you must have gnu-sed installed as sed for this to work properly. 23 | 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`. 24 | 25 | # Building 26 | 27 | ```sh 28 | godep go build ./client 29 | ``` 30 | 31 | # Tests 32 | 33 | ```sh 34 | godep go test ./client 35 | ``` 36 | # Contact 37 | For bugs, questions, comments, corrections, suggestions, etc., open an issue in 38 | [rancher/rancher](//github.com/rancher/rancher/issues) with a title starting with `[go-rancher] `. 39 | 40 | Or just [click here](//github.com/rancher/rancher/issues/new?title=%5Bgo-rancher%5D%20) to create a new issue. 41 | 42 | 43 | # License 44 | Copyright (c) 2014-2015 [Rancher Labs, Inc.](http://rancher.com) 45 | 46 | Licensed under the Apache License, Version 2.0 (the "License"); 47 | you may not use this file except in compliance with the License. 48 | You may obtain a copy of the License at 49 | 50 | [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 51 | 52 | Unless required by applicable law or agreed to in writing, software 53 | distributed under the License is distributed on an "AS IS" BASIS, 54 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | See the License for the specific language governing permissions and 56 | limitations under the License. 57 | 58 | -------------------------------------------------------------------------------- /api/context.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/gorilla/context" 7 | "github.com/rancher/go-rancher/client" 8 | ) 9 | 10 | type key int 11 | 12 | const ( 13 | contextKey key = 0 14 | ) 15 | 16 | type ApiContext struct { 17 | r *http.Request 18 | schemas *client.Schemas 19 | UrlBuilder UrlBuilder 20 | apiResponseWriter ApiResponseWriter 21 | responseWriter http.ResponseWriter 22 | } 23 | 24 | func GetApiContext(r *http.Request) *ApiContext { 25 | if rv := context.Get(r, contextKey); rv != nil { 26 | return rv.(*ApiContext) 27 | } 28 | return nil 29 | } 30 | 31 | func CreateApiContext(rw http.ResponseWriter, r *http.Request, schemas *client.Schemas) error { 32 | urlBuilder, err := NewUrlBuilder(r, schemas) 33 | if err != nil { 34 | return err 35 | } 36 | 37 | apiContext := &ApiContext{ 38 | r: r, 39 | schemas: schemas, 40 | UrlBuilder: urlBuilder, 41 | apiResponseWriter: parseResponseType(r), 42 | responseWriter: rw, 43 | } 44 | 45 | context.Set(r, contextKey, apiContext) 46 | return nil 47 | } 48 | -------------------------------------------------------------------------------- /api/html_writer.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | "strings" 7 | ) 8 | 9 | const ( 10 | before = ` 11 | 13 | 14 | 15 | `) 29 | ) 30 | 31 | type HtmlWriter struct { 32 | CssUrl, JsUrl string 33 | r *http.Request 34 | } 35 | 36 | func (j *HtmlWriter) Write(obj interface{}, rw http.ResponseWriter) error { 37 | apiContext := GetApiContext(j.r) 38 | rw.Header().Set("X-API-Schemas", apiContext.UrlBuilder.Collection("schema")) 39 | 40 | if rw.Header().Get("Content-Type") == "" { 41 | rw.Header().Set("Content-Type", "text/html; charset=utf-8") 42 | } 43 | 44 | if _, err := rw.Write([]byte(j.before())); err != nil { 45 | return err 46 | } 47 | 48 | enc := json.NewEncoder(rw) 49 | if err := enc.Encode(obj); err != nil { 50 | return err 51 | } 52 | 53 | if _, err := rw.Write([]byte(after)); err != nil { 54 | return err 55 | } 56 | 57 | return nil 58 | } 59 | 60 | func (j *HtmlWriter) before() string { 61 | css := j.CssUrl 62 | if css == "" { 63 | css = defaultCssUrl 64 | } 65 | 66 | js := j.JsUrl 67 | if js == "" { 68 | js = defaultJsUrl 69 | } 70 | 71 | apiContext := GetApiContext(j.r) 72 | 73 | content := strings.Replace(before, "%CSS%", css, -1) 74 | content = strings.Replace(content, "%JS%", js, -1) 75 | content = strings.Replace(content, "%SCHEMAS%", apiContext.UrlBuilder.Collection("schema"), -1) 76 | 77 | return content 78 | } 79 | -------------------------------------------------------------------------------- /api/json_writer.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | ) 7 | 8 | type JsonWriter struct { 9 | r *http.Request 10 | } 11 | 12 | func (j *JsonWriter) Write(obj interface{}, rw http.ResponseWriter) error { 13 | apiContext := GetApiContext(j.r) 14 | rw.Header().Set("X-API-Schemas", apiContext.UrlBuilder.Collection("schema")) 15 | 16 | if rw.Header().Get("Content-Type") == "" { 17 | rw.Header().Set("Content-Type", "application/json") 18 | } 19 | 20 | enc := json.NewEncoder(rw) 21 | enc.SetEscapeHTML(false) 22 | return enc.Encode(obj) 23 | } 24 | -------------------------------------------------------------------------------- /catalog/client.go: -------------------------------------------------------------------------------- 1 | package catalog 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 | customHeaders map[string]string 14 | } 15 | 16 | type RancherBaseClient interface { 17 | Websocket(string, map[string][]string) (*websocket.Conn, *http.Response, error) 18 | List(string, *ListOpts, interface{}) error 19 | Post(string, interface{}, interface{}) error 20 | GetLink(Resource, string, interface{}) error 21 | Create(string, interface{}, interface{}) error 22 | Update(string, *Resource, interface{}, interface{}) error 23 | ById(string, string, interface{}) error 24 | Delete(*Resource) error 25 | Reload(*Resource, interface{}) error 26 | Action(string, string, *Resource, interface{}, interface{}) error 27 | GetOpts() *ClientOpts 28 | GetSchemas() *Schemas 29 | GetTypes() map[string]Schema 30 | SetCustomHeaders(headers map[string]string) 31 | 32 | doGet(string, *ListOpts, interface{}) error 33 | doList(string, *ListOpts, interface{}) error 34 | doNext(string, interface{}) error 35 | doModify(string, string, interface{}, interface{}) error 36 | doCreate(string, interface{}, interface{}) error 37 | doUpdate(string, *Resource, interface{}, interface{}) error 38 | doById(string, string, interface{}) error 39 | doResourceDelete(string, *Resource) error 40 | doAction(string, string, *Resource, interface{}, interface{}) error 41 | } 42 | -------------------------------------------------------------------------------- /catalog/generated_api_version.go: -------------------------------------------------------------------------------- 1 | package catalog 2 | 3 | const ( 4 | API_VERSION_TYPE = "apiVersion" 5 | ) 6 | 7 | type ApiVersion struct { 8 | Resource `yaml:"-"` 9 | 10 | Actions map[string]string `json:"actions,omitempty" yaml:"actions,omitempty"` 11 | 12 | Links map[string]string `json:"links,omitempty" yaml:"links,omitempty"` 13 | 14 | Type string `json:"type,omitempty" yaml:"type,omitempty"` 15 | } 16 | 17 | type ApiVersionCollection struct { 18 | Collection 19 | Data []ApiVersion `json:"data,omitempty"` 20 | client *ApiVersionClient 21 | } 22 | 23 | type ApiVersionClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type ApiVersionOperations interface { 28 | List(opts *ListOpts) (*ApiVersionCollection, error) 29 | Create(opts *ApiVersion) (*ApiVersion, error) 30 | Update(existing *ApiVersion, updates interface{}) (*ApiVersion, error) 31 | ById(id string) (*ApiVersion, error) 32 | Delete(container *ApiVersion) error 33 | } 34 | 35 | func newApiVersionClient(rancherClient *RancherClient) *ApiVersionClient { 36 | return &ApiVersionClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *ApiVersionClient) Create(container *ApiVersion) (*ApiVersion, error) { 42 | resp := &ApiVersion{} 43 | err := c.rancherClient.doCreate(API_VERSION_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *ApiVersionClient) Update(existing *ApiVersion, updates interface{}) (*ApiVersion, error) { 48 | resp := &ApiVersion{} 49 | err := c.rancherClient.doUpdate(API_VERSION_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *ApiVersionClient) List(opts *ListOpts) (*ApiVersionCollection, error) { 54 | resp := &ApiVersionCollection{} 55 | err := c.rancherClient.doList(API_VERSION_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *ApiVersionCollection) Next() (*ApiVersionCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &ApiVersionCollection{} 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 *ApiVersionClient) ById(id string) (*ApiVersion, error) { 71 | resp := &ApiVersion{} 72 | err := c.rancherClient.doById(API_VERSION_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 *ApiVersionClient) Delete(container *ApiVersion) error { 82 | return c.rancherClient.doResourceDelete(API_VERSION_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /catalog/generated_client.go: -------------------------------------------------------------------------------- 1 | package catalog 2 | 3 | type RancherClient struct { 4 | RancherBaseClient 5 | 6 | ApiVersion ApiVersionOperations 7 | Catalog CatalogOperations 8 | Template TemplateOperations 9 | Question QuestionOperations 10 | TemplateVersion TemplateVersionOperations 11 | Error ErrorOperations 12 | } 13 | 14 | func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient { 15 | client := &RancherClient{ 16 | RancherBaseClient: rancherBaseClient, 17 | } 18 | 19 | client.ApiVersion = newApiVersionClient(client) 20 | client.Catalog = newCatalogClient(client) 21 | client.Template = newTemplateClient(client) 22 | client.Question = newQuestionClient(client) 23 | client.TemplateVersion = newTemplateVersionClient(client) 24 | client.Error = newErrorClient(client) 25 | 26 | return client 27 | } 28 | 29 | func NewRancherClient(opts *ClientOpts) (*RancherClient, error) { 30 | rancherBaseClient := &RancherBaseClientImpl{ 31 | Types: map[string]Schema{}, 32 | } 33 | client := constructClient(rancherBaseClient) 34 | 35 | err := setupRancherBaseClient(rancherBaseClient, opts) 36 | if err != nil { 37 | return nil, err 38 | } 39 | 40 | return client, nil 41 | } 42 | -------------------------------------------------------------------------------- /catalog/generated_error.go: -------------------------------------------------------------------------------- 1 | package catalog 2 | 3 | const ( 4 | ERROR_TYPE = "error" 5 | ) 6 | 7 | type Error struct { 8 | Resource `yaml:"-"` 9 | 10 | Actions map[string]string `json:"actions,omitempty" yaml:"actions,omitempty"` 11 | 12 | Links map[string]string `json:"links,omitempty" yaml:"links,omitempty"` 13 | 14 | Message string `json:"message,omitempty" yaml:"message,omitempty"` 15 | 16 | Status string `json:"status,omitempty" yaml:"status,omitempty"` 17 | 18 | Type string `json:"type,omitempty" yaml:"type,omitempty"` 19 | } 20 | 21 | type ErrorCollection struct { 22 | Collection 23 | Data []Error `json:"data,omitempty"` 24 | client *ErrorClient 25 | } 26 | 27 | type ErrorClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type ErrorOperations interface { 32 | List(opts *ListOpts) (*ErrorCollection, error) 33 | Create(opts *Error) (*Error, error) 34 | Update(existing *Error, updates interface{}) (*Error, error) 35 | ById(id string) (*Error, error) 36 | Delete(container *Error) error 37 | } 38 | 39 | func newErrorClient(rancherClient *RancherClient) *ErrorClient { 40 | return &ErrorClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *ErrorClient) Create(container *Error) (*Error, error) { 46 | resp := &Error{} 47 | err := c.rancherClient.doCreate(ERROR_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ErrorClient) Update(existing *Error, updates interface{}) (*Error, error) { 52 | resp := &Error{} 53 | err := c.rancherClient.doUpdate(ERROR_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *ErrorClient) List(opts *ListOpts) (*ErrorCollection, error) { 58 | resp := &ErrorCollection{} 59 | err := c.rancherClient.doList(ERROR_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *ErrorCollection) Next() (*ErrorCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &ErrorCollection{} 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 *ErrorClient) ById(id string) (*Error, error) { 75 | resp := &Error{} 76 | err := c.rancherClient.doById(ERROR_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 *ErrorClient) Delete(container *Error) error { 86 | return c.rancherClient.doResourceDelete(ERROR_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /client/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 | 27 | doGet(string, *ListOpts, interface{}) error 28 | doList(string, *ListOpts, interface{}) error 29 | doNext(string, interface{}) error 30 | doModify(string, string, interface{}, interface{}) error 31 | doCreate(string, interface{}, interface{}) error 32 | doUpdate(string, *Resource, interface{}, interface{}) error 33 | doById(string, string, interface{}) error 34 | doResourceDelete(string, *Resource) error 35 | doAction(string, string, *Resource, interface{}, interface{}) error 36 | } 37 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/generated_config_item.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONFIG_ITEM_TYPE = "configItem" 5 | ) 6 | 7 | type ConfigItem struct { 8 | Resource 9 | 10 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 11 | 12 | SourceVersion string `json:"sourceVersion,omitempty" yaml:"source_version,omitempty"` 13 | } 14 | 15 | type ConfigItemCollection struct { 16 | Collection 17 | Data []ConfigItem `json:"data,omitempty"` 18 | client *ConfigItemClient 19 | } 20 | 21 | type ConfigItemClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type ConfigItemOperations interface { 26 | List(opts *ListOpts) (*ConfigItemCollection, error) 27 | Create(opts *ConfigItem) (*ConfigItem, error) 28 | Update(existing *ConfigItem, updates interface{}) (*ConfigItem, error) 29 | ById(id string) (*ConfigItem, error) 30 | Delete(container *ConfigItem) error 31 | } 32 | 33 | func newConfigItemClient(rancherClient *RancherClient) *ConfigItemClient { 34 | return &ConfigItemClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *ConfigItemClient) Create(container *ConfigItem) (*ConfigItem, error) { 40 | resp := &ConfigItem{} 41 | err := c.rancherClient.doCreate(CONFIG_ITEM_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *ConfigItemClient) Update(existing *ConfigItem, updates interface{}) (*ConfigItem, error) { 46 | resp := &ConfigItem{} 47 | err := c.rancherClient.doUpdate(CONFIG_ITEM_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ConfigItemClient) List(opts *ListOpts) (*ConfigItemCollection, error) { 52 | resp := &ConfigItemCollection{} 53 | err := c.rancherClient.doList(CONFIG_ITEM_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *ConfigItemCollection) Next() (*ConfigItemCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &ConfigItemCollection{} 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 *ConfigItemClient) ById(id string) (*ConfigItem, error) { 69 | resp := &ConfigItem{} 70 | err := c.rancherClient.doById(CONFIG_ITEM_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 *ConfigItemClient) Delete(container *ConfigItem) error { 80 | return c.rancherClient.doResourceDelete(CONFIG_ITEM_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/generated_ha_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HA_CONFIG_TYPE = "haConfig" 5 | ) 6 | 7 | type HaConfig struct { 8 | Resource 9 | 10 | ClusterSize int64 `json:"clusterSize,omitempty" yaml:"cluster_size,omitempty"` 11 | 12 | DbHost string `json:"dbHost,omitempty" yaml:"db_host,omitempty"` 13 | 14 | DbSize int64 `json:"dbSize,omitempty" yaml:"db_size,omitempty"` 15 | 16 | Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` 17 | } 18 | 19 | type HaConfigCollection struct { 20 | Collection 21 | Data []HaConfig `json:"data,omitempty"` 22 | client *HaConfigClient 23 | } 24 | 25 | type HaConfigClient struct { 26 | rancherClient *RancherClient 27 | } 28 | 29 | type HaConfigOperations interface { 30 | List(opts *ListOpts) (*HaConfigCollection, error) 31 | Create(opts *HaConfig) (*HaConfig, error) 32 | Update(existing *HaConfig, updates interface{}) (*HaConfig, error) 33 | ById(id string) (*HaConfig, error) 34 | Delete(container *HaConfig) error 35 | } 36 | 37 | func newHaConfigClient(rancherClient *RancherClient) *HaConfigClient { 38 | return &HaConfigClient{ 39 | rancherClient: rancherClient, 40 | } 41 | } 42 | 43 | func (c *HaConfigClient) Create(container *HaConfig) (*HaConfig, error) { 44 | resp := &HaConfig{} 45 | err := c.rancherClient.doCreate(HA_CONFIG_TYPE, container, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *HaConfigClient) Update(existing *HaConfig, updates interface{}) (*HaConfig, error) { 50 | resp := &HaConfig{} 51 | err := c.rancherClient.doUpdate(HA_CONFIG_TYPE, &existing.Resource, updates, resp) 52 | return resp, err 53 | } 54 | 55 | func (c *HaConfigClient) List(opts *ListOpts) (*HaConfigCollection, error) { 56 | resp := &HaConfigCollection{} 57 | err := c.rancherClient.doList(HA_CONFIG_TYPE, opts, resp) 58 | resp.client = c 59 | return resp, err 60 | } 61 | 62 | func (cc *HaConfigCollection) Next() (*HaConfigCollection, error) { 63 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 64 | resp := &HaConfigCollection{} 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 *HaConfigClient) ById(id string) (*HaConfig, error) { 73 | resp := &HaConfig{} 74 | err := c.rancherClient.doById(HA_CONFIG_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 *HaConfigClient) Delete(container *HaConfig) error { 84 | return c.rancherClient.doResourceDelete(HA_CONFIG_TYPE, &container.Resource) 85 | } 86 | -------------------------------------------------------------------------------- /client/generated_haproxy_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HAPROXY_CONFIG_TYPE = "haproxyConfig" 5 | ) 6 | 7 | type HaproxyConfig struct { 8 | Resource 9 | 10 | Defaults string `json:"defaults,omitempty" yaml:"defaults,omitempty"` 11 | 12 | Global string `json:"global,omitempty" yaml:"global,omitempty"` 13 | } 14 | 15 | type HaproxyConfigCollection struct { 16 | Collection 17 | Data []HaproxyConfig `json:"data,omitempty"` 18 | client *HaproxyConfigClient 19 | } 20 | 21 | type HaproxyConfigClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type HaproxyConfigOperations interface { 26 | List(opts *ListOpts) (*HaproxyConfigCollection, error) 27 | Create(opts *HaproxyConfig) (*HaproxyConfig, error) 28 | Update(existing *HaproxyConfig, updates interface{}) (*HaproxyConfig, error) 29 | ById(id string) (*HaproxyConfig, error) 30 | Delete(container *HaproxyConfig) error 31 | } 32 | 33 | func newHaproxyConfigClient(rancherClient *RancherClient) *HaproxyConfigClient { 34 | return &HaproxyConfigClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *HaproxyConfigClient) Create(container *HaproxyConfig) (*HaproxyConfig, error) { 40 | resp := &HaproxyConfig{} 41 | err := c.rancherClient.doCreate(HAPROXY_CONFIG_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *HaproxyConfigClient) Update(existing *HaproxyConfig, updates interface{}) (*HaproxyConfig, error) { 46 | resp := &HaproxyConfig{} 47 | err := c.rancherClient.doUpdate(HAPROXY_CONFIG_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *HaproxyConfigClient) List(opts *ListOpts) (*HaproxyConfigCollection, error) { 52 | resp := &HaproxyConfigCollection{} 53 | err := c.rancherClient.doList(HAPROXY_CONFIG_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *HaproxyConfigCollection) Next() (*HaproxyConfigCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &HaproxyConfigCollection{} 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 *HaproxyConfigClient) ById(id string) (*HaproxyConfig, error) { 69 | resp := &HaproxyConfig{} 70 | err := c.rancherClient.doById(HAPROXY_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 *HaproxyConfigClient) Delete(container *HaproxyConfig) error { 80 | return c.rancherClient.doResourceDelete(HAPROXY_CONFIG_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/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 | Timeout int64 `json:"timeout,omitempty" yaml:"timeout,omitempty"` 13 | } 14 | 15 | type InstanceStopCollection struct { 16 | Collection 17 | Data []InstanceStop `json:"data,omitempty"` 18 | client *InstanceStopClient 19 | } 20 | 21 | type InstanceStopClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type InstanceStopOperations interface { 26 | List(opts *ListOpts) (*InstanceStopCollection, error) 27 | Create(opts *InstanceStop) (*InstanceStop, error) 28 | Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) 29 | ById(id string) (*InstanceStop, error) 30 | Delete(container *InstanceStop) error 31 | } 32 | 33 | func newInstanceStopClient(rancherClient *RancherClient) *InstanceStopClient { 34 | return &InstanceStopClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *InstanceStopClient) Create(container *InstanceStop) (*InstanceStop, error) { 40 | resp := &InstanceStop{} 41 | err := c.rancherClient.doCreate(INSTANCE_STOP_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *InstanceStopClient) Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) { 46 | resp := &InstanceStop{} 47 | err := c.rancherClient.doUpdate(INSTANCE_STOP_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *InstanceStopClient) List(opts *ListOpts) (*InstanceStopCollection, error) { 52 | resp := &InstanceStopCollection{} 53 | err := c.rancherClient.doList(INSTANCE_STOP_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *InstanceStopCollection) Next() (*InstanceStopCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &InstanceStopCollection{} 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 *InstanceStopClient) ById(id string) (*InstanceStop, error) { 69 | resp := &InstanceStop{} 70 | err := c.rancherClient.doById(INSTANCE_STOP_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 *InstanceStopClient) Delete(container *InstanceStop) error { 80 | return c.rancherClient.doResourceDelete(INSTANCE_STOP_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/generated_nfs_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | NFS_CONFIG_TYPE = "nfsConfig" 5 | ) 6 | 7 | type NfsConfig struct { 8 | Resource 9 | 10 | MountOptions string `json:"mountOptions,omitempty" yaml:"mount_options,omitempty"` 11 | 12 | Server string `json:"server,omitempty" yaml:"server,omitempty"` 13 | 14 | Share string `json:"share,omitempty" yaml:"share,omitempty"` 15 | } 16 | 17 | type NfsConfigCollection struct { 18 | Collection 19 | Data []NfsConfig `json:"data,omitempty"` 20 | client *NfsConfigClient 21 | } 22 | 23 | type NfsConfigClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type NfsConfigOperations interface { 28 | List(opts *ListOpts) (*NfsConfigCollection, error) 29 | Create(opts *NfsConfig) (*NfsConfig, error) 30 | Update(existing *NfsConfig, updates interface{}) (*NfsConfig, error) 31 | ById(id string) (*NfsConfig, error) 32 | Delete(container *NfsConfig) error 33 | } 34 | 35 | func newNfsConfigClient(rancherClient *RancherClient) *NfsConfigClient { 36 | return &NfsConfigClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *NfsConfigClient) Create(container *NfsConfig) (*NfsConfig, error) { 42 | resp := &NfsConfig{} 43 | err := c.rancherClient.doCreate(NFS_CONFIG_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *NfsConfigClient) Update(existing *NfsConfig, updates interface{}) (*NfsConfig, error) { 48 | resp := &NfsConfig{} 49 | err := c.rancherClient.doUpdate(NFS_CONFIG_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *NfsConfigClient) List(opts *ListOpts) (*NfsConfigCollection, error) { 54 | resp := &NfsConfigCollection{} 55 | err := c.rancherClient.doList(NFS_CONFIG_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *NfsConfigCollection) Next() (*NfsConfigCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &NfsConfigCollection{} 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 *NfsConfigClient) ById(id string) (*NfsConfig, error) { 71 | resp := &NfsConfig{} 72 | err := c.rancherClient.doById(NFS_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 *NfsConfigClient) Delete(container *NfsConfig) error { 82 | return c.rancherClient.doResourceDelete(NFS_CONFIG_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/generated_scale_policy.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SCALE_POLICY_TYPE = "scalePolicy" 5 | ) 6 | 7 | type ScalePolicy struct { 8 | Resource 9 | 10 | Increment int64 `json:"increment,omitempty" yaml:"increment,omitempty"` 11 | 12 | Max int64 `json:"max,omitempty" yaml:"max,omitempty"` 13 | 14 | Min int64 `json:"min,omitempty" yaml:"min,omitempty"` 15 | } 16 | 17 | type ScalePolicyCollection struct { 18 | Collection 19 | Data []ScalePolicy `json:"data,omitempty"` 20 | client *ScalePolicyClient 21 | } 22 | 23 | type ScalePolicyClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type ScalePolicyOperations interface { 28 | List(opts *ListOpts) (*ScalePolicyCollection, error) 29 | Create(opts *ScalePolicy) (*ScalePolicy, error) 30 | Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) 31 | ById(id string) (*ScalePolicy, error) 32 | Delete(container *ScalePolicy) error 33 | } 34 | 35 | func newScalePolicyClient(rancherClient *RancherClient) *ScalePolicyClient { 36 | return &ScalePolicyClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *ScalePolicyClient) Create(container *ScalePolicy) (*ScalePolicy, error) { 42 | resp := &ScalePolicy{} 43 | err := c.rancherClient.doCreate(SCALE_POLICY_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *ScalePolicyClient) Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) { 48 | resp := &ScalePolicy{} 49 | err := c.rancherClient.doUpdate(SCALE_POLICY_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *ScalePolicyClient) List(opts *ListOpts) (*ScalePolicyCollection, error) { 54 | resp := &ScalePolicyCollection{} 55 | err := c.rancherClient.doList(SCALE_POLICY_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *ScalePolicyCollection) Next() (*ScalePolicyCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &ScalePolicyCollection{} 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 *ScalePolicyClient) ById(id string) (*ScalePolicy, error) { 71 | resp := &ScalePolicy{} 72 | err := c.rancherClient.doById(SCALE_POLICY_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 *ScalePolicyClient) Delete(container *ScalePolicy) error { 82 | return c.rancherClient.doResourceDelete(SCALE_POLICY_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /client/generated_service_link.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_LINK_TYPE = "serviceLink" 5 | ) 6 | 7 | type ServiceLink struct { 8 | Resource 9 | 10 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 11 | 12 | ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` 13 | 14 | Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` 15 | } 16 | 17 | type ServiceLinkCollection struct { 18 | Collection 19 | Data []ServiceLink `json:"data,omitempty"` 20 | client *ServiceLinkClient 21 | } 22 | 23 | type ServiceLinkClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type ServiceLinkOperations interface { 28 | List(opts *ListOpts) (*ServiceLinkCollection, error) 29 | Create(opts *ServiceLink) (*ServiceLink, error) 30 | Update(existing *ServiceLink, updates interface{}) (*ServiceLink, error) 31 | ById(id string) (*ServiceLink, error) 32 | Delete(container *ServiceLink) error 33 | } 34 | 35 | func newServiceLinkClient(rancherClient *RancherClient) *ServiceLinkClient { 36 | return &ServiceLinkClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *ServiceLinkClient) Create(container *ServiceLink) (*ServiceLink, error) { 42 | resp := &ServiceLink{} 43 | err := c.rancherClient.doCreate(SERVICE_LINK_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *ServiceLinkClient) Update(existing *ServiceLink, updates interface{}) (*ServiceLink, error) { 48 | resp := &ServiceLink{} 49 | err := c.rancherClient.doUpdate(SERVICE_LINK_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *ServiceLinkClient) List(opts *ListOpts) (*ServiceLinkCollection, error) { 54 | resp := &ServiceLinkCollection{} 55 | err := c.rancherClient.doList(SERVICE_LINK_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *ServiceLinkCollection) Next() (*ServiceLinkCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &ServiceLinkCollection{} 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 *ServiceLinkClient) ById(id string) (*ServiceLink, error) { 71 | resp := &ServiceLink{} 72 | err := c.rancherClient.doById(SERVICE_LINK_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 *ServiceLinkClient) Delete(container *ServiceLink) error { 82 | return c.rancherClient.doResourceDelete(SERVICE_LINK_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /client/generated_service_restart.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_RESTART_TYPE = "serviceRestart" 5 | ) 6 | 7 | type ServiceRestart struct { 8 | Resource 9 | 10 | RollingRestartStrategy RollingRestartStrategy `json:"rollingRestartStrategy,omitempty" yaml:"rolling_restart_strategy,omitempty"` 11 | } 12 | 13 | type ServiceRestartCollection struct { 14 | Collection 15 | Data []ServiceRestart `json:"data,omitempty"` 16 | client *ServiceRestartClient 17 | } 18 | 19 | type ServiceRestartClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ServiceRestartOperations interface { 24 | List(opts *ListOpts) (*ServiceRestartCollection, error) 25 | Create(opts *ServiceRestart) (*ServiceRestart, error) 26 | Update(existing *ServiceRestart, updates interface{}) (*ServiceRestart, error) 27 | ById(id string) (*ServiceRestart, error) 28 | Delete(container *ServiceRestart) error 29 | } 30 | 31 | func newServiceRestartClient(rancherClient *RancherClient) *ServiceRestartClient { 32 | return &ServiceRestartClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ServiceRestartClient) Create(container *ServiceRestart) (*ServiceRestart, error) { 38 | resp := &ServiceRestart{} 39 | err := c.rancherClient.doCreate(SERVICE_RESTART_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ServiceRestartClient) Update(existing *ServiceRestart, updates interface{}) (*ServiceRestart, error) { 44 | resp := &ServiceRestart{} 45 | err := c.rancherClient.doUpdate(SERVICE_RESTART_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ServiceRestartClient) List(opts *ListOpts) (*ServiceRestartCollection, error) { 50 | resp := &ServiceRestartCollection{} 51 | err := c.rancherClient.doList(SERVICE_RESTART_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ServiceRestartCollection) Next() (*ServiceRestartCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ServiceRestartCollection{} 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 *ServiceRestartClient) ById(id string) (*ServiceRestart, error) { 67 | resp := &ServiceRestart{} 68 | err := c.rancherClient.doById(SERVICE_RESTART_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 *ServiceRestartClient) Delete(container *ServiceRestart) error { 78 | return c.rancherClient.doResourceDelete(SERVICE_RESTART_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /client/generated_set_labels_input.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SET_LABELS_INPUT_TYPE = "setLabelsInput" 5 | ) 6 | 7 | type SetLabelsInput struct { 8 | Resource 9 | 10 | Labels interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` 11 | } 12 | 13 | type SetLabelsInputCollection struct { 14 | Collection 15 | Data []SetLabelsInput `json:"data,omitempty"` 16 | client *SetLabelsInputClient 17 | } 18 | 19 | type SetLabelsInputClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type SetLabelsInputOperations interface { 24 | List(opts *ListOpts) (*SetLabelsInputCollection, error) 25 | Create(opts *SetLabelsInput) (*SetLabelsInput, error) 26 | Update(existing *SetLabelsInput, updates interface{}) (*SetLabelsInput, error) 27 | ById(id string) (*SetLabelsInput, error) 28 | Delete(container *SetLabelsInput) error 29 | } 30 | 31 | func newSetLabelsInputClient(rancherClient *RancherClient) *SetLabelsInputClient { 32 | return &SetLabelsInputClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *SetLabelsInputClient) Create(container *SetLabelsInput) (*SetLabelsInput, error) { 38 | resp := &SetLabelsInput{} 39 | err := c.rancherClient.doCreate(SET_LABELS_INPUT_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *SetLabelsInputClient) Update(existing *SetLabelsInput, updates interface{}) (*SetLabelsInput, error) { 44 | resp := &SetLabelsInput{} 45 | err := c.rancherClient.doUpdate(SET_LABELS_INPUT_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *SetLabelsInputClient) List(opts *ListOpts) (*SetLabelsInputCollection, error) { 50 | resp := &SetLabelsInputCollection{} 51 | err := c.rancherClient.doList(SET_LABELS_INPUT_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *SetLabelsInputCollection) Next() (*SetLabelsInputCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &SetLabelsInputCollection{} 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 *SetLabelsInputClient) ById(id string) (*SetLabelsInput, error) { 67 | resp := &SetLabelsInput{} 68 | err := c.rancherClient.doById(SET_LABELS_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 *SetLabelsInputClient) Delete(container *SetLabelsInput) error { 78 | return c.rancherClient.doResourceDelete(SET_LABELS_INPUT_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /client/generated_setting.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SETTING_TYPE = "setting" 5 | ) 6 | 7 | type Setting struct { 8 | Resource 9 | 10 | ActiveValue string `json:"activeValue,omitempty" yaml:"active_value,omitempty"` 11 | 12 | InDb bool `json:"inDb,omitempty" yaml:"in_db,omitempty"` 13 | 14 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 15 | 16 | Source string `json:"source,omitempty" yaml:"source,omitempty"` 17 | 18 | Value string `json:"value,omitempty" yaml:"value,omitempty"` 19 | } 20 | 21 | type SettingCollection struct { 22 | Collection 23 | Data []Setting `json:"data,omitempty"` 24 | client *SettingClient 25 | } 26 | 27 | type SettingClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type SettingOperations interface { 32 | List(opts *ListOpts) (*SettingCollection, error) 33 | Create(opts *Setting) (*Setting, error) 34 | Update(existing *Setting, updates interface{}) (*Setting, error) 35 | ById(id string) (*Setting, error) 36 | Delete(container *Setting) error 37 | } 38 | 39 | func newSettingClient(rancherClient *RancherClient) *SettingClient { 40 | return &SettingClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *SettingClient) Create(container *Setting) (*Setting, error) { 46 | resp := &Setting{} 47 | err := c.rancherClient.doCreate(SETTING_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *SettingClient) Update(existing *Setting, updates interface{}) (*Setting, error) { 52 | resp := &Setting{} 53 | err := c.rancherClient.doUpdate(SETTING_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *SettingClient) List(opts *ListOpts) (*SettingCollection, error) { 58 | resp := &SettingCollection{} 59 | err := c.rancherClient.doList(SETTING_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *SettingCollection) Next() (*SettingCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &SettingCollection{} 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 *SettingClient) ById(id string) (*Setting, error) { 75 | resp := &Setting{} 76 | err := c.rancherClient.doById(SETTING_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 *SettingClient) Delete(container *Setting) error { 86 | return c.rancherClient.doResourceDelete(SETTING_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /client/generated_state_transition.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STATE_TRANSITION_TYPE = "stateTransition" 5 | ) 6 | 7 | type StateTransition struct { 8 | Resource 9 | } 10 | 11 | type StateTransitionCollection struct { 12 | Collection 13 | Data []StateTransition `json:"data,omitempty"` 14 | client *StateTransitionClient 15 | } 16 | 17 | type StateTransitionClient struct { 18 | rancherClient *RancherClient 19 | } 20 | 21 | type StateTransitionOperations interface { 22 | List(opts *ListOpts) (*StateTransitionCollection, error) 23 | Create(opts *StateTransition) (*StateTransition, error) 24 | Update(existing *StateTransition, updates interface{}) (*StateTransition, error) 25 | ById(id string) (*StateTransition, error) 26 | Delete(container *StateTransition) error 27 | } 28 | 29 | func newStateTransitionClient(rancherClient *RancherClient) *StateTransitionClient { 30 | return &StateTransitionClient{ 31 | rancherClient: rancherClient, 32 | } 33 | } 34 | 35 | func (c *StateTransitionClient) Create(container *StateTransition) (*StateTransition, error) { 36 | resp := &StateTransition{} 37 | err := c.rancherClient.doCreate(STATE_TRANSITION_TYPE, container, resp) 38 | return resp, err 39 | } 40 | 41 | func (c *StateTransitionClient) Update(existing *StateTransition, updates interface{}) (*StateTransition, error) { 42 | resp := &StateTransition{} 43 | err := c.rancherClient.doUpdate(STATE_TRANSITION_TYPE, &existing.Resource, updates, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *StateTransitionClient) List(opts *ListOpts) (*StateTransitionCollection, error) { 48 | resp := &StateTransitionCollection{} 49 | err := c.rancherClient.doList(STATE_TRANSITION_TYPE, opts, resp) 50 | resp.client = c 51 | return resp, err 52 | } 53 | 54 | func (cc *StateTransitionCollection) Next() (*StateTransitionCollection, error) { 55 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 56 | resp := &StateTransitionCollection{} 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 *StateTransitionClient) ById(id string) (*StateTransition, error) { 65 | resp := &StateTransition{} 66 | err := c.rancherClient.doById(STATE_TRANSITION_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 *StateTransitionClient) Delete(container *StateTransition) error { 76 | return c.rancherClient.doResourceDelete(STATE_TRANSITION_TYPE, &container.Resource) 77 | } 78 | -------------------------------------------------------------------------------- /client/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 | Token string `json:"token,omitempty" yaml:"token,omitempty"` 11 | 12 | Url string `json:"url,omitempty" yaml:"url,omitempty"` 13 | } 14 | 15 | type StatsAccessCollection struct { 16 | Collection 17 | Data []StatsAccess `json:"data,omitempty"` 18 | client *StatsAccessClient 19 | } 20 | 21 | type StatsAccessClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type StatsAccessOperations interface { 26 | List(opts *ListOpts) (*StatsAccessCollection, error) 27 | Create(opts *StatsAccess) (*StatsAccess, error) 28 | Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) 29 | ById(id string) (*StatsAccess, error) 30 | Delete(container *StatsAccess) error 31 | } 32 | 33 | func newStatsAccessClient(rancherClient *RancherClient) *StatsAccessClient { 34 | return &StatsAccessClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *StatsAccessClient) Create(container *StatsAccess) (*StatsAccess, error) { 40 | resp := &StatsAccess{} 41 | err := c.rancherClient.doCreate(STATS_ACCESS_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *StatsAccessClient) Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) { 46 | resp := &StatsAccess{} 47 | err := c.rancherClient.doUpdate(STATS_ACCESS_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *StatsAccessClient) List(opts *ListOpts) (*StatsAccessCollection, error) { 52 | resp := &StatsAccessCollection{} 53 | err := c.rancherClient.doList(STATS_ACCESS_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *StatsAccessCollection) Next() (*StatsAccessCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &StatsAccessCollection{} 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 *StatsAccessClient) ById(id string) (*StatsAccess, error) { 69 | resp := &StatsAccess{} 70 | err := c.rancherClient.doById(STATS_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 *StatsAccessClient) Delete(container *StatsAccess) error { 80 | return c.rancherClient.doResourceDelete(STATS_ACCESS_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /client/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 | -------------------------------------------------------------------------------- /client/generated_task.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | TASK_TYPE = "task" 5 | ) 6 | 7 | type Task struct { 8 | Resource 9 | 10 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 11 | } 12 | 13 | type TaskCollection struct { 14 | Collection 15 | Data []Task `json:"data,omitempty"` 16 | client *TaskClient 17 | } 18 | 19 | type TaskClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type TaskOperations interface { 24 | List(opts *ListOpts) (*TaskCollection, error) 25 | Create(opts *Task) (*Task, error) 26 | Update(existing *Task, updates interface{}) (*Task, error) 27 | ById(id string) (*Task, error) 28 | Delete(container *Task) error 29 | 30 | ActionExecute(*Task) (*Task, error) 31 | } 32 | 33 | func newTaskClient(rancherClient *RancherClient) *TaskClient { 34 | return &TaskClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *TaskClient) Create(container *Task) (*Task, error) { 40 | resp := &Task{} 41 | err := c.rancherClient.doCreate(TASK_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *TaskClient) Update(existing *Task, updates interface{}) (*Task, error) { 46 | resp := &Task{} 47 | err := c.rancherClient.doUpdate(TASK_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *TaskClient) List(opts *ListOpts) (*TaskCollection, error) { 52 | resp := &TaskCollection{} 53 | err := c.rancherClient.doList(TASK_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *TaskCollection) Next() (*TaskCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &TaskCollection{} 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 *TaskClient) ById(id string) (*Task, error) { 69 | resp := &Task{} 70 | err := c.rancherClient.doById(TASK_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 *TaskClient) Delete(container *Task) error { 80 | return c.rancherClient.doResourceDelete(TASK_TYPE, &container.Resource) 81 | } 82 | 83 | func (c *TaskClient) ActionExecute(resource *Task) (*Task, error) { 84 | 85 | resp := &Task{} 86 | 87 | err := c.rancherClient.doAction(TASK_TYPE, "execute", &resource.Resource, nil, resp) 88 | 89 | return resp, err 90 | } 91 | -------------------------------------------------------------------------------- /docs/input/common_fields.yml: -------------------------------------------------------------------------------- 1 | kind: true 2 | created: true 3 | state: true 4 | transitioning: true 5 | transitioningMessage: true 6 | transitioningProgress: true 7 | uuid: true 8 | removeTime: true 9 | removed: true 10 | accountId: true 11 | -------------------------------------------------------------------------------- /docs/input/generic_descriptions.yml: -------------------------------------------------------------------------------- 1 | id: The unique identifier for the 2 | created: The date of when the was created. 3 | state: The current state of the . The options are ``. 4 | transitioning: Whether or not the is in a transitioning state 5 | transitioningMessage: The message to show while in a transitioning state 6 | transitioningProgress: The percentage remaining in the transitioning process of the 7 | uuid: The universally unique identifier for the . This will always be unique across Rancher installations. 8 | removeTime: The date and time of when the was removed 9 | removed: The date of when the was removed 10 | accountId: The unique identifier for the associated account 11 | agentId: The unique identifier of the associated agent 12 | instanceId: The unique identifier for the associated instance 13 | serviceId: The unique identifier of the associated service 14 | hostId: The unique identifier for the associated host 15 | region: The region to use when launching the host 16 | publicValue: The public value of the 17 | secretValue: The secret value of the 18 | sshUser: The ssh username to use to ssh into the host 19 | sshPort: The port to ssh into the host 20 | labels: A map of key value pairs to be used as labels for the 21 | -------------------------------------------------------------------------------- /docs/input/schema-check/blacklist_actions.yml: -------------------------------------------------------------------------------- 1 | create: true 2 | purge: true 3 | remove: true 4 | restore: true 5 | update: true 6 | -------------------------------------------------------------------------------- /docs/input/schema-check/blacklist_collections.yml: -------------------------------------------------------------------------------- 1 | backup: true 2 | backupTarget: true 3 | composeProject: true 4 | composeService: true 5 | containerEvent: true 6 | credential: true 7 | externalDnsEvent: true 8 | externalEvent: true 9 | externalHostEvent: true 10 | externalServiceEvent: true 11 | externalStoragePoolEvent: true 12 | externalVolumeEvent: true 13 | healthcheckInstanceHostMap: true 14 | image: true 15 | instance: true 16 | instanceLink: true 17 | ipAddress: true 18 | kubernetesService: true 19 | kubernetesStack: true 20 | label: true 21 | mount: true 22 | password: true 23 | physicalHost: true 24 | port: true 25 | register: true 26 | serviceConsumeMap: true 27 | serviceExposeMap: true 28 | serviceEvent: true 29 | serviceProxy: true 30 | snapshot: true 31 | storagePool: true 32 | typeDocumentation: true 33 | virtualMachine: true 34 | -------------------------------------------------------------------------------- /docs/input/schema-check/blacklist_resource_fields.yml: -------------------------------------------------------------------------------- 1 | storageDriver-blockDevicePath: true 2 | storageDriver-volumeCapabilities: true 3 | -------------------------------------------------------------------------------- /docs/input/schema-check/blank_collection_api_description.yml: -------------------------------------------------------------------------------- 1 | account-description: 2 | apiKey-description: 3 | auditLog-description: 4 | certificate-description: 5 | container-description: 6 | dnsService-description: 7 | externalService-description: 8 | genericObject-description: 9 | host-description: 10 | identity-description: 11 | loadBalancerService-description: 12 | machine-description: 13 | machineDriver-description: 14 | network-description: 15 | networkDriver-description: 16 | networkDriverService-description: 17 | project-description: 18 | projectMember-description: 19 | projectTemplate-description: 20 | pullTask-description: 21 | registrationToken-description: 22 | registry-description: 23 | registryCredential-description: 24 | service-description: 25 | serviceLog-description: 26 | setting-description: 27 | stack-description: 28 | storageDriver-description: 29 | storageDriverService-description: 30 | subnet-description: 31 | subscribe-description: 32 | volume-description: 33 | volumeTemplate-description: 34 | 35 | -------------------------------------------------------------------------------- /docs/input/serviceExample.yml: -------------------------------------------------------------------------------- 1 | accountId: "1a10" 2 | createIndex: 0 3 | created: "2016-08-19T19:14:32Z" 4 | environmentId: "1e1" 5 | externalId: null 6 | healthState: "healthy" 7 | id: 0 8 | kind: "service" 9 | name: "ubuntuName" 10 | removed: null 11 | state: "activating" 12 | uuid: "ac98a109-a3e5-4d9a-9198-417549760c0e" 13 | vip": null, 14 | "transitioning": "yes", 15 | "transitioningMessage": "Reconciling", 16 | "transitioningProgress": 0, 17 | "scale": 1, 18 | "currentScale": 0, 19 | "scalePolicy": null, 20 | "launchConfig": { 21 | "capAdd": [], 22 | "capDrop": [], 23 | "count": null, 24 | "cpuSet": null, 25 | "cpuShares": null, 26 | "dataVolumes": [], 27 | "dataVolumesFrom": [], 28 | "description": null, 29 | "devices": [], 30 | "dns": [], 31 | "dnsSearch": [], 32 | "domainName": null, 33 | "hostname": null, 34 | "imageUuid": "docker:ubuntu:14.04.3", 35 | "kind": "container", 36 | "labels": { 37 | "io.rancher.container.pull_image": "always" 38 | }, 39 | "logConfig": { 40 | "config": {}, 41 | "driver": "" 42 | }, 43 | "memory": null, 44 | "memoryMb": null, 45 | "memorySwap": null, 46 | "networkMode": "managed", 47 | "pidMode": null, 48 | "ports": [], 49 | "privileged": false, 50 | "publishAllPorts": false, 51 | "readOnly": false, 52 | "requestedIpAddress": null, 53 | "startOnCreate": true, 54 | "stdinOpen": false, 55 | "tty": true, 56 | "user": null, 57 | "userdata": null, 58 | "version": "0", 59 | "volumeDriver": null, 60 | "workingDir": null, 61 | "dataVolumesFromLaunchConfigs": [], 62 | "networkLaunchConfig": null, 63 | "vcpu": 1 64 | }, 65 | "upgrade": null, 66 | "secondaryLaunchConfigs": [], 67 | "metadata": null, 68 | "fqdn": null, 69 | "publicEndpoints": [] 70 | -------------------------------------------------------------------------------- /docs/input/serviceJSONExample.yml: -------------------------------------------------------------------------------- 1 | 2 | "accountId": "1a10", 3 | "createIndex": 0, 4 | "created": "2016-08-19T19:14:32Z", 5 | "environmentId": "1e1", 6 | "externalId": null, 7 | "healthState": "healthy", 8 | "id": 0, 9 | "kind": "service", 10 | "name": "testName", 11 | "removed": null, 12 | "state": "activating", 13 | "uuid": "ac98a109-a3e5-4d9a-9198-417549760c0e", 14 | "vip": null, 15 | "transitioning": "yes", 16 | "transitioningMessage": "Reconciling", 17 | "transitioningProgress": 0, 18 | "scale": 1, 19 | "currentScale": 0, 20 | "scalePolicy": null, 21 | "launchConfig": { 22 | "capAdd": [], 23 | "capDrop": [], 24 | "count": null, 25 | "cpuSet": null, 26 | "cpuShares": null, 27 | "dataVolumes": [], 28 | "dataVolumesFrom": [], 29 | "description": null, 30 | "devices": [], 31 | "dns": [], 32 | "dnsSearch": [], 33 | "domainName": null, 34 | "hostname": null, 35 | "imageUuid": "docker:ubuntu:14.04.3", 36 | "kind": "container", 37 | "labels": { 38 | "io.rancher.container.pull_image": "always" 39 | }, 40 | "logConfig": { 41 | "config": {}, 42 | "driver": "" 43 | }, 44 | "memory": null, 45 | "memoryMb": null, 46 | "memorySwap": null, 47 | "networkMode": "managed", 48 | "pidMode": null, 49 | "ports": [], 50 | "privileged": false, 51 | "publishAllPorts": false, 52 | "readOnly": false, 53 | "requestedIpAddress": null, 54 | "startOnCreate": true, 55 | "stdinOpen": false, 56 | "tty": true, 57 | "user": null, 58 | "userdata": null, 59 | "version": "0", 60 | "volumeDriver": null, 61 | "workingDir": null, 62 | "dataVolumesFromLaunchConfigs": [], 63 | "networkLaunchConfig": null, 64 | "vcpu": 1 65 | }, 66 | "upgrade": null, 67 | "secondaryLaunchConfigs": [], 68 | "metadata": null, 69 | "fqdn": null, 70 | "publicEndpoints": [] 71 | -------------------------------------------------------------------------------- /docs/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "os" 6 | 7 | log "github.com/Sirupsen/logrus" 8 | ) 9 | 10 | var ( 11 | command = flag.String("command", "", "generate-docs | generate-description | generate-collection-description") 12 | version = flag.String("version", "v1.0", "docs version") 13 | apiVersion = flag.String("apiVersion", "v1.0", "api version") 14 | language = flag.String("lang", "en", "docs language") 15 | layout = flag.String("layout", "rancher-default", "docs layout") 16 | ) 17 | 18 | func main() { 19 | 20 | flag.Parse() 21 | 22 | if *command != "" { 23 | 24 | switch *command { 25 | case "generate-collection-description": 26 | log.Info("Generating the api collections descriptions file...") 27 | err := generateDescriptionFile(false, true, true, false, false) 28 | if err != nil { 29 | log.Fatal(err) 30 | os.Exit(1) 31 | } 32 | log.Info("Done...") 33 | case "generate-description": 34 | log.Info("Generating the api descriptions file...") 35 | err := generateDescriptionFile(false, false, true, true, true) 36 | if err != nil { 37 | log.Fatal(err) 38 | os.Exit(1) 39 | } 40 | log.Info("Done...") 41 | case "generate-docs": 42 | log.Info("Generating the api docs...") 43 | err := generateFiles() 44 | if err != nil { 45 | log.Fatal(err) 46 | os.Exit(1) 47 | } 48 | log.Info("Done...") 49 | case "generate-empty-description": 50 | log.Info("Generating the api descriptions file with empty descriptions...") 51 | err := generateDescriptionFile(true, false, true, true, true) 52 | if err != nil { 53 | log.Fatal(err) 54 | os.Exit(1) 55 | } 56 | log.Info("Done...") 57 | case "generate-only-resource-fields": 58 | log.Info("Generating only the resource fields for json input...") 59 | err := generateDescriptionFile(true, false, false, false, true) 60 | if err != nil { 61 | log.Fatal(err) 62 | os.Exit(1) 63 | } 64 | log.Info("Done...") 65 | } 66 | } else { 67 | log.Info("Please provide a command [generate-docs | generate-description]") 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /docs/templates/apiActionInput.template: -------------------------------------------------------------------------------- 1 | --- 2 | title: API 3 | layout: {{.layout}} 4 | version: {{.version}} 5 | lang: {{.language}} 6 | apiVersion: {{.apiVersion}} 7 | redirect_from: 8 | - /rancher/{{.version}}/zh/api/{{.apiVersion}}/api-resources/{{.schemaId}}/ 9 | --- 10 | 11 | ## {{.schemaId}} 12 | 13 | {{.resourceDescription}} 14 | {{if or $.writeableFieldMap $.readOnlyFieldMap}} 15 | ### Resource Fields 16 | {{if $.writeableFieldMap}} 17 | #### Writeable Fields 18 | 19 | Field | Type | Create | Update | Default | Notes 20 | ---|---|---|---|---|--- 21 | {{range $key, $value := .writeableFieldMap}}{{$key}} | {{if $value.TypeURL}}{{$value.TypeURL}}{{else}}{{$value.Type}}{{end}} | {{if $value.Create}}{{if $value.Required}}Yes{{else}}Optional{{end}}{{else}}-{{end}} | {{if $value.Update}}Yes{{else}}-{{end}} | {{if $value.Default}}{{$value.Default}}{{else}}-{{end}} | {{$value.Description}} 22 | {{end}}{{end}} 23 | {{if $.readOnlyFieldMap}} 24 | #### Read Only Fields 25 | 26 | Field | Type | Notes 27 | ---|---|--- 28 | {{range $key, $value := .readOnlyFieldMap}}{{$key}} | {{if $value.TypeURL}}{{$value.TypeURL}}{{else}}{{$value.Type}}{{end}} | {{$value.Description}} 29 | {{end}}{{end}} 30 | {{end}} 31 |
32 | -------------------------------------------------------------------------------- /docs/templates/apiDescription.template: -------------------------------------------------------------------------------- 1 | {{range $name, $resource := .descriptionMap}}{{$name}}: {{$resource}} 2 | {{end}} 3 | -------------------------------------------------------------------------------- /docs/templates/apiHomePage.template: -------------------------------------------------------------------------------- 1 | --- 2 | title: API Resources 3 | layout: {{.layout}} 4 | version: {{.version}} 5 | lang: {{.language}} 6 | apiVersion: {{.apiVersion}} 7 | redirect_from: 8 | - /rancher/{{.version}}/zh/api/{{.apiVersion}}/api-resources/ 9 | --- 10 | 11 | ## API Resources 12 | 13 | {{if $.schemaMap}}{{range $resourceId, $resourceData := .schemaMap}}{{range $link, $val := $resourceData.Resource.Links}}{{if eq $link "showResource"}} 14 |
15 | 16 | [{{$resourceId | capitalize}}]({{"{{"}}site.baseurl{{"}}"}}/rancher/{{"{{"}}page.version{{"}}"}}/{{"{{"}}page.lang{{"}}"}}/api/{{"{{"}}page.apiVersion{{"}}"}}/api-resources/{{$resourceId}}/)| 17 | ---| 18 | {{$resourceId | getResourceDescription }} | 19 | {{end}}{{end}}{{end}}{{end}} 20 | -------------------------------------------------------------------------------- /generator/client.template: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | type RancherClient struct { 4 | RancherBaseClient 5 | {{range .schemas}} 6 | {{.Id}} {{.Id}}Operations{{end}} 7 | } 8 | 9 | func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient { 10 | client := &RancherClient{ 11 | RancherBaseClient: rancherBaseClient, 12 | } 13 | 14 | {{range .schemas}} 15 | client.{{.Id}} = new{{.Id}}Client(client){{end}} 16 | 17 | 18 | return client 19 | } 20 | 21 | func NewRancherClient(opts *ClientOpts) (*RancherClient, error) { 22 | rancherBaseClient := &RancherBaseClientImpl { 23 | Types: map[string]Schema{}, 24 | } 25 | client := constructClient(rancherBaseClient) 26 | 27 | err := setupRancherBaseClient(rancherBaseClient, opts) 28 | if err != nil { 29 | return nil, err 30 | } 31 | 32 | return client, nil 33 | } 34 | -------------------------------------------------------------------------------- /hostaccess/instance.go: -------------------------------------------------------------------------------- 1 | package hostaccess 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gorilla/websocket" 7 | "github.com/rancher/go-rancher/v2" 8 | ) 9 | 10 | type RancherWebsocketClient client.RancherClient 11 | 12 | func (c *RancherWebsocketClient) GetHostAccess(resource client.Resource, action string, input interface{}) (*websocket.Conn, error) { 13 | var resp client.HostAccess 14 | url := resource.Actions[action] 15 | if url == "" { 16 | return nil, fmt.Errorf("Failed to find action: %s", action) 17 | } 18 | 19 | err := c.Post(url, input, &resp) 20 | if err != nil { 21 | return nil, err 22 | } 23 | 24 | url = fmt.Sprintf("%s?token=%s", resp.Url, resp.Token) 25 | 26 | conn, _, err := c.Websocket(url, nil) 27 | 28 | return conn, err 29 | } 30 | -------------------------------------------------------------------------------- /hostaccess_v3/instance.go: -------------------------------------------------------------------------------- 1 | package hostaccess_v3 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gorilla/websocket" 7 | "github.com/rancher/go-rancher/v3" 8 | ) 9 | 10 | type RancherWebsocketClient client.RancherClient 11 | 12 | func (c *RancherWebsocketClient) GetHostAccess(resource client.Resource, action string, input interface{}) (*websocket.Conn, error) { 13 | var resp client.HostAccess 14 | url := resource.Actions[action] 15 | if url == "" { 16 | return nil, fmt.Errorf("Failed to find action: %s", action) 17 | } 18 | 19 | err := c.Post(url, input, &resp) 20 | if err != nil { 21 | return nil, err 22 | } 23 | 24 | url = fmt.Sprintf("%s?token=%s", resp.Url, resp.Token) 25 | 26 | conn, _, err := c.Websocket(url, nil) 27 | 28 | return conn, err 29 | } 30 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | _ "github.com/rancher/go-rancher/client" 6 | ) 7 | 8 | func main() { 9 | fmt.Println("I have nothing to do...") 10 | } 11 | -------------------------------------------------------------------------------- /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 | [ "$(uname)" != "Darwin" ] && LINKFLAGS="-linkmode external -extldflags -static -s" 10 | go build -ldflags "-X main.VERSION=$VERSION $LINKFLAGS" -o bin/go-rancher 11 | -------------------------------------------------------------------------------- /scripts/ci: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd $(dirname $0) 5 | 6 | ./build 7 | ./test 8 | ./validate 9 | -------------------------------------------------------------------------------- /scripts/common_functions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | set_project_vars() 5 | { 6 | PACKAGE=./gopath/src/$(<.package) 7 | PROJECT=$(basename $PACKAGE) 8 | 9 | export GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/gopath 10 | } 11 | 12 | gen() { 13 | BASE=$1 14 | 15 | curl -s "$BASE/schemas?_role=service" | jq . > schemas.json 16 | echo Saved schemas.json 17 | 18 | echo -n Generating go code... 19 | rm -rf ../output/generated_* || true 20 | go run generator.go 21 | echo " Done" 22 | 23 | gofmt -w ../output/generated_* 24 | echo Formatted code 25 | 26 | if [ -n "$3" ]; then 27 | rm -rf ../$2/generated_* 28 | mv ../output/* ../$2 29 | sed -i -e 's/package client/package '$2'/g' ../$2/*.go 30 | else 31 | mv ../output/* ../$2 32 | fi 33 | 34 | rm -rf ../output 35 | rm schemas.json 36 | } 37 | -------------------------------------------------------------------------------- /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 | exec ./scripts/"$@" 9 | else 10 | exec "$@" 11 | fi 12 | -------------------------------------------------------------------------------- /scripts/gen-api-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd $(dirname $0)/../docs 5 | 6 | #curl -s http://localhost:8080/v1/schemas?_role=project | jq . > ./input/schemas.json 7 | curl -s http://localhost:8080/v2-beta/schemas?_role=project | jq . > ./input/schemas.json 8 | echo Saved schemas.json 9 | 10 | go run *.go -command=generate-collection-description 11 | go run *.go -command=generate-description 12 | go run *.go -command=generate-empty-description 13 | go run *.go -command=generate-only-resource-fields 14 | 15 | #go run *.go -command=generate-docs -version=v1.3 -lang=en -layout=rancher-api-v1-default-v1.3 -apiVersion=v1 16 | go run *.go -command=generate-docs -version=v1.3 -lang=en -layout=rancher-api-v2-beta-default-v1.3 -apiVersion=v2-beta 17 | 18 | echo Success 19 | -------------------------------------------------------------------------------- /scripts/gen-schema.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | usage() 3 | { 4 | echo "Usage: $0 " 5 | echo "Usage: Do not use folder name as 'client' or 'v2'" 6 | exit 1 7 | } 8 | 9 | if [ "$#" -ne 2 ] 10 | then 11 | usage 12 | fi 13 | 14 | if [ "$2" == "client" ] || [ "$2" == "v2" ] 15 | then 16 | usage 17 | fi 18 | 19 | set -e -x 20 | 21 | cd $(dirname $0)/../generator 22 | 23 | source $(dirname "$0")/../scripts/common_functions 24 | 25 | gen $1 $2 rename 26 | 27 | echo Success 28 | -------------------------------------------------------------------------------- /scripts/generate-rancher-schemas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | 4 | usage() 5 | { 6 | echo "Usage: $0 " 7 | echo "Usage: schema_version is v2 or v3. V2 is for rancher v1.6.x and V3 is for rancher v2.0" 8 | exit 1 9 | } 10 | 11 | cd $(dirname $0)/../generator 12 | 13 | SCHEMA=$1 14 | URL_BASE='http://localhost:8080' 15 | 16 | if [ "$#" -gt 2 ] 17 | then 18 | usage 19 | fi 20 | 21 | if [ "$1" != "v2" ] && [ "$1" != "v3" ] 22 | then 23 | usage 24 | fi 25 | 26 | if [ "$2" != "" ]; then 27 | URL_BASE=$2 28 | fi 29 | 30 | if [ "$1" == "v2" ] 31 | then 32 | SCHEMA='v2-beta' 33 | fi 34 | 35 | echo -n Waiting for cattle ${URL_BASE}/ping 36 | while ! curl -fs ${URL_BASE}/ping; do 37 | echo -n . 38 | sleep 1 39 | done 40 | echo 41 | 42 | source ../scripts/common_functions 43 | 44 | gen ${URL_BASE}/v1-catalog catalog rename 45 | gen "${URL_BASE}/$SCHEMA" $1 46 | 47 | echo Success 48 | -------------------------------------------------------------------------------- /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 | [ "${ARCH}" == "amd64" ] && RACE=-race 9 | go test ${RACE} -cover -tags=test ./... 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/generated_binding.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | BINDING_TYPE = "binding" 5 | ) 6 | 7 | type Binding struct { 8 | Resource 9 | 10 | Services map[string]interface{} `json:"services,omitempty" yaml:"services,omitempty"` 11 | } 12 | 13 | type BindingCollection struct { 14 | Collection 15 | Data []Binding `json:"data,omitempty"` 16 | client *BindingClient 17 | } 18 | 19 | type BindingClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type BindingOperations interface { 24 | List(opts *ListOpts) (*BindingCollection, error) 25 | Create(opts *Binding) (*Binding, error) 26 | Update(existing *Binding, updates interface{}) (*Binding, error) 27 | ById(id string) (*Binding, error) 28 | Delete(container *Binding) error 29 | } 30 | 31 | func newBindingClient(rancherClient *RancherClient) *BindingClient { 32 | return &BindingClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *BindingClient) Create(container *Binding) (*Binding, error) { 38 | resp := &Binding{} 39 | err := c.rancherClient.doCreate(BINDING_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *BindingClient) Update(existing *Binding, updates interface{}) (*Binding, error) { 44 | resp := &Binding{} 45 | err := c.rancherClient.doUpdate(BINDING_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *BindingClient) List(opts *ListOpts) (*BindingCollection, error) { 50 | resp := &BindingCollection{} 51 | err := c.rancherClient.doList(BINDING_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *BindingCollection) Next() (*BindingCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &BindingCollection{} 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 *BindingClient) ById(id string) (*Binding, error) { 67 | resp := &Binding{} 68 | err := c.rancherClient.doById(BINDING_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 *BindingClient) Delete(container *Binding) error { 78 | return c.rancherClient.doResourceDelete(BINDING_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /v2/generated_config_item.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONFIG_ITEM_TYPE = "configItem" 5 | ) 6 | 7 | type ConfigItem struct { 8 | Resource 9 | 10 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 11 | 12 | SourceVersion string `json:"sourceVersion,omitempty" yaml:"source_version,omitempty"` 13 | } 14 | 15 | type ConfigItemCollection struct { 16 | Collection 17 | Data []ConfigItem `json:"data,omitempty"` 18 | client *ConfigItemClient 19 | } 20 | 21 | type ConfigItemClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type ConfigItemOperations interface { 26 | List(opts *ListOpts) (*ConfigItemCollection, error) 27 | Create(opts *ConfigItem) (*ConfigItem, error) 28 | Update(existing *ConfigItem, updates interface{}) (*ConfigItem, error) 29 | ById(id string) (*ConfigItem, error) 30 | Delete(container *ConfigItem) error 31 | } 32 | 33 | func newConfigItemClient(rancherClient *RancherClient) *ConfigItemClient { 34 | return &ConfigItemClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *ConfigItemClient) Create(container *ConfigItem) (*ConfigItem, error) { 40 | resp := &ConfigItem{} 41 | err := c.rancherClient.doCreate(CONFIG_ITEM_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *ConfigItemClient) Update(existing *ConfigItem, updates interface{}) (*ConfigItem, error) { 46 | resp := &ConfigItem{} 47 | err := c.rancherClient.doUpdate(CONFIG_ITEM_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *ConfigItemClient) List(opts *ListOpts) (*ConfigItemCollection, error) { 52 | resp := &ConfigItemCollection{} 53 | err := c.rancherClient.doList(CONFIG_ITEM_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *ConfigItemCollection) Next() (*ConfigItemCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &ConfigItemCollection{} 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 *ConfigItemClient) ById(id string) (*ConfigItem, error) { 69 | resp := &ConfigItem{} 70 | err := c.rancherClient.doById(CONFIG_ITEM_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 *ConfigItemClient) Delete(container *ConfigItem) error { 80 | return c.rancherClient.doResourceDelete(CONFIG_ITEM_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/generated_ha_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HA_CONFIG_TYPE = "haConfig" 5 | ) 6 | 7 | type HaConfig struct { 8 | Resource 9 | 10 | ClusterSize int64 `json:"clusterSize,omitempty" yaml:"cluster_size,omitempty"` 11 | 12 | DbHost string `json:"dbHost,omitempty" yaml:"db_host,omitempty"` 13 | 14 | DbSize int64 `json:"dbSize,omitempty" yaml:"db_size,omitempty"` 15 | 16 | Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` 17 | } 18 | 19 | type HaConfigCollection struct { 20 | Collection 21 | Data []HaConfig `json:"data,omitempty"` 22 | client *HaConfigClient 23 | } 24 | 25 | type HaConfigClient struct { 26 | rancherClient *RancherClient 27 | } 28 | 29 | type HaConfigOperations interface { 30 | List(opts *ListOpts) (*HaConfigCollection, error) 31 | Create(opts *HaConfig) (*HaConfig, error) 32 | Update(existing *HaConfig, updates interface{}) (*HaConfig, error) 33 | ById(id string) (*HaConfig, error) 34 | Delete(container *HaConfig) error 35 | } 36 | 37 | func newHaConfigClient(rancherClient *RancherClient) *HaConfigClient { 38 | return &HaConfigClient{ 39 | rancherClient: rancherClient, 40 | } 41 | } 42 | 43 | func (c *HaConfigClient) Create(container *HaConfig) (*HaConfig, error) { 44 | resp := &HaConfig{} 45 | err := c.rancherClient.doCreate(HA_CONFIG_TYPE, container, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *HaConfigClient) Update(existing *HaConfig, updates interface{}) (*HaConfig, error) { 50 | resp := &HaConfig{} 51 | err := c.rancherClient.doUpdate(HA_CONFIG_TYPE, &existing.Resource, updates, resp) 52 | return resp, err 53 | } 54 | 55 | func (c *HaConfigClient) List(opts *ListOpts) (*HaConfigCollection, error) { 56 | resp := &HaConfigCollection{} 57 | err := c.rancherClient.doList(HA_CONFIG_TYPE, opts, resp) 58 | resp.client = c 59 | return resp, err 60 | } 61 | 62 | func (cc *HaConfigCollection) Next() (*HaConfigCollection, error) { 63 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 64 | resp := &HaConfigCollection{} 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 *HaConfigClient) ById(id string) (*HaConfig, error) { 73 | resp := &HaConfig{} 74 | err := c.rancherClient.doById(HA_CONFIG_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 *HaConfigClient) Delete(container *HaConfig) error { 84 | return c.rancherClient.doResourceDelete(HA_CONFIG_TYPE, &container.Resource) 85 | } 86 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/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 | Timeout int64 `json:"timeout,omitempty" yaml:"timeout,omitempty"` 13 | } 14 | 15 | type InstanceStopCollection struct { 16 | Collection 17 | Data []InstanceStop `json:"data,omitempty"` 18 | client *InstanceStopClient 19 | } 20 | 21 | type InstanceStopClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type InstanceStopOperations interface { 26 | List(opts *ListOpts) (*InstanceStopCollection, error) 27 | Create(opts *InstanceStop) (*InstanceStop, error) 28 | Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) 29 | ById(id string) (*InstanceStop, error) 30 | Delete(container *InstanceStop) error 31 | } 32 | 33 | func newInstanceStopClient(rancherClient *RancherClient) *InstanceStopClient { 34 | return &InstanceStopClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *InstanceStopClient) Create(container *InstanceStop) (*InstanceStop, error) { 40 | resp := &InstanceStop{} 41 | err := c.rancherClient.doCreate(INSTANCE_STOP_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *InstanceStopClient) Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) { 46 | resp := &InstanceStop{} 47 | err := c.rancherClient.doUpdate(INSTANCE_STOP_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *InstanceStopClient) List(opts *ListOpts) (*InstanceStopCollection, error) { 52 | resp := &InstanceStopCollection{} 53 | err := c.rancherClient.doList(INSTANCE_STOP_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *InstanceStopCollection) Next() (*InstanceStopCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &InstanceStopCollection{} 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 *InstanceStopClient) ById(id string) (*InstanceStop, error) { 69 | resp := &InstanceStop{} 70 | err := c.rancherClient.doById(INSTANCE_STOP_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 *InstanceStopClient) Delete(container *InstanceStop) error { 80 | return c.rancherClient.doResourceDelete(INSTANCE_STOP_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/generated_nfs_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | NFS_CONFIG_TYPE = "nfsConfig" 5 | ) 6 | 7 | type NfsConfig struct { 8 | Resource 9 | 10 | MountOptions string `json:"mountOptions,omitempty" yaml:"mount_options,omitempty"` 11 | 12 | Server string `json:"server,omitempty" yaml:"server,omitempty"` 13 | 14 | Share string `json:"share,omitempty" yaml:"share,omitempty"` 15 | } 16 | 17 | type NfsConfigCollection struct { 18 | Collection 19 | Data []NfsConfig `json:"data,omitempty"` 20 | client *NfsConfigClient 21 | } 22 | 23 | type NfsConfigClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type NfsConfigOperations interface { 28 | List(opts *ListOpts) (*NfsConfigCollection, error) 29 | Create(opts *NfsConfig) (*NfsConfig, error) 30 | Update(existing *NfsConfig, updates interface{}) (*NfsConfig, error) 31 | ById(id string) (*NfsConfig, error) 32 | Delete(container *NfsConfig) error 33 | } 34 | 35 | func newNfsConfigClient(rancherClient *RancherClient) *NfsConfigClient { 36 | return &NfsConfigClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *NfsConfigClient) Create(container *NfsConfig) (*NfsConfig, error) { 42 | resp := &NfsConfig{} 43 | err := c.rancherClient.doCreate(NFS_CONFIG_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *NfsConfigClient) Update(existing *NfsConfig, updates interface{}) (*NfsConfig, error) { 48 | resp := &NfsConfig{} 49 | err := c.rancherClient.doUpdate(NFS_CONFIG_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *NfsConfigClient) List(opts *ListOpts) (*NfsConfigCollection, error) { 54 | resp := &NfsConfigCollection{} 55 | err := c.rancherClient.doList(NFS_CONFIG_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *NfsConfigCollection) Next() (*NfsConfigCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &NfsConfigCollection{} 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 *NfsConfigClient) ById(id string) (*NfsConfig, error) { 71 | resp := &NfsConfig{} 72 | err := c.rancherClient.doById(NFS_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 *NfsConfigClient) Delete(container *NfsConfig) error { 82 | return c.rancherClient.doResourceDelete(NFS_CONFIG_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /v2/generated_scale_policy.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SCALE_POLICY_TYPE = "scalePolicy" 5 | ) 6 | 7 | type ScalePolicy struct { 8 | Resource 9 | 10 | Increment int64 `json:"increment,omitempty" yaml:"increment,omitempty"` 11 | 12 | Max int64 `json:"max,omitempty" yaml:"max,omitempty"` 13 | 14 | Min int64 `json:"min,omitempty" yaml:"min,omitempty"` 15 | } 16 | 17 | type ScalePolicyCollection struct { 18 | Collection 19 | Data []ScalePolicy `json:"data,omitempty"` 20 | client *ScalePolicyClient 21 | } 22 | 23 | type ScalePolicyClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type ScalePolicyOperations interface { 28 | List(opts *ListOpts) (*ScalePolicyCollection, error) 29 | Create(opts *ScalePolicy) (*ScalePolicy, error) 30 | Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) 31 | ById(id string) (*ScalePolicy, error) 32 | Delete(container *ScalePolicy) error 33 | } 34 | 35 | func newScalePolicyClient(rancherClient *RancherClient) *ScalePolicyClient { 36 | return &ScalePolicyClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *ScalePolicyClient) Create(container *ScalePolicy) (*ScalePolicy, error) { 42 | resp := &ScalePolicy{} 43 | err := c.rancherClient.doCreate(SCALE_POLICY_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *ScalePolicyClient) Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) { 48 | resp := &ScalePolicy{} 49 | err := c.rancherClient.doUpdate(SCALE_POLICY_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *ScalePolicyClient) List(opts *ListOpts) (*ScalePolicyCollection, error) { 54 | resp := &ScalePolicyCollection{} 55 | err := c.rancherClient.doList(SCALE_POLICY_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *ScalePolicyCollection) Next() (*ScalePolicyCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &ScalePolicyCollection{} 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 *ScalePolicyClient) ById(id string) (*ScalePolicy, error) { 71 | resp := &ScalePolicy{} 72 | err := c.rancherClient.doById(SCALE_POLICY_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 *ScalePolicyClient) Delete(container *ScalePolicy) error { 82 | return c.rancherClient.doResourceDelete(SCALE_POLICY_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /v2/generated_service_restart.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_RESTART_TYPE = "serviceRestart" 5 | ) 6 | 7 | type ServiceRestart struct { 8 | Resource 9 | 10 | RollingRestartStrategy RollingRestartStrategy `json:"rollingRestartStrategy,omitempty" yaml:"rolling_restart_strategy,omitempty"` 11 | } 12 | 13 | type ServiceRestartCollection struct { 14 | Collection 15 | Data []ServiceRestart `json:"data,omitempty"` 16 | client *ServiceRestartClient 17 | } 18 | 19 | type ServiceRestartClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ServiceRestartOperations interface { 24 | List(opts *ListOpts) (*ServiceRestartCollection, error) 25 | Create(opts *ServiceRestart) (*ServiceRestart, error) 26 | Update(existing *ServiceRestart, updates interface{}) (*ServiceRestart, error) 27 | ById(id string) (*ServiceRestart, error) 28 | Delete(container *ServiceRestart) error 29 | } 30 | 31 | func newServiceRestartClient(rancherClient *RancherClient) *ServiceRestartClient { 32 | return &ServiceRestartClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ServiceRestartClient) Create(container *ServiceRestart) (*ServiceRestart, error) { 38 | resp := &ServiceRestart{} 39 | err := c.rancherClient.doCreate(SERVICE_RESTART_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ServiceRestartClient) Update(existing *ServiceRestart, updates interface{}) (*ServiceRestart, error) { 44 | resp := &ServiceRestart{} 45 | err := c.rancherClient.doUpdate(SERVICE_RESTART_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ServiceRestartClient) List(opts *ListOpts) (*ServiceRestartCollection, error) { 50 | resp := &ServiceRestartCollection{} 51 | err := c.rancherClient.doList(SERVICE_RESTART_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ServiceRestartCollection) Next() (*ServiceRestartCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ServiceRestartCollection{} 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 *ServiceRestartClient) ById(id string) (*ServiceRestart, error) { 67 | resp := &ServiceRestart{} 68 | err := c.rancherClient.doById(SERVICE_RESTART_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 *ServiceRestartClient) Delete(container *ServiceRestart) error { 78 | return c.rancherClient.doResourceDelete(SERVICE_RESTART_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /v2/generated_setting.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SETTING_TYPE = "setting" 5 | ) 6 | 7 | type Setting struct { 8 | Resource 9 | 10 | ActiveValue string `json:"activeValue,omitempty" yaml:"active_value,omitempty"` 11 | 12 | InDb bool `json:"inDb,omitempty" yaml:"in_db,omitempty"` 13 | 14 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 15 | 16 | Source string `json:"source,omitempty" yaml:"source,omitempty"` 17 | 18 | Value string `json:"value,omitempty" yaml:"value,omitempty"` 19 | } 20 | 21 | type SettingCollection struct { 22 | Collection 23 | Data []Setting `json:"data,omitempty"` 24 | client *SettingClient 25 | } 26 | 27 | type SettingClient struct { 28 | rancherClient *RancherClient 29 | } 30 | 31 | type SettingOperations interface { 32 | List(opts *ListOpts) (*SettingCollection, error) 33 | Create(opts *Setting) (*Setting, error) 34 | Update(existing *Setting, updates interface{}) (*Setting, error) 35 | ById(id string) (*Setting, error) 36 | Delete(container *Setting) error 37 | } 38 | 39 | func newSettingClient(rancherClient *RancherClient) *SettingClient { 40 | return &SettingClient{ 41 | rancherClient: rancherClient, 42 | } 43 | } 44 | 45 | func (c *SettingClient) Create(container *Setting) (*Setting, error) { 46 | resp := &Setting{} 47 | err := c.rancherClient.doCreate(SETTING_TYPE, container, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *SettingClient) Update(existing *Setting, updates interface{}) (*Setting, error) { 52 | resp := &Setting{} 53 | err := c.rancherClient.doUpdate(SETTING_TYPE, &existing.Resource, updates, resp) 54 | return resp, err 55 | } 56 | 57 | func (c *SettingClient) List(opts *ListOpts) (*SettingCollection, error) { 58 | resp := &SettingCollection{} 59 | err := c.rancherClient.doList(SETTING_TYPE, opts, resp) 60 | resp.client = c 61 | return resp, err 62 | } 63 | 64 | func (cc *SettingCollection) Next() (*SettingCollection, error) { 65 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 66 | resp := &SettingCollection{} 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 *SettingClient) ById(id string) (*Setting, error) { 75 | resp := &Setting{} 76 | err := c.rancherClient.doById(SETTING_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 *SettingClient) Delete(container *Setting) error { 86 | return c.rancherClient.doResourceDelete(SETTING_TYPE, &container.Resource) 87 | } 88 | -------------------------------------------------------------------------------- /v2/generated_state_transition.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STATE_TRANSITION_TYPE = "stateTransition" 5 | ) 6 | 7 | type StateTransition struct { 8 | Resource 9 | } 10 | 11 | type StateTransitionCollection struct { 12 | Collection 13 | Data []StateTransition `json:"data,omitempty"` 14 | client *StateTransitionClient 15 | } 16 | 17 | type StateTransitionClient struct { 18 | rancherClient *RancherClient 19 | } 20 | 21 | type StateTransitionOperations interface { 22 | List(opts *ListOpts) (*StateTransitionCollection, error) 23 | Create(opts *StateTransition) (*StateTransition, error) 24 | Update(existing *StateTransition, updates interface{}) (*StateTransition, error) 25 | ById(id string) (*StateTransition, error) 26 | Delete(container *StateTransition) error 27 | } 28 | 29 | func newStateTransitionClient(rancherClient *RancherClient) *StateTransitionClient { 30 | return &StateTransitionClient{ 31 | rancherClient: rancherClient, 32 | } 33 | } 34 | 35 | func (c *StateTransitionClient) Create(container *StateTransition) (*StateTransition, error) { 36 | resp := &StateTransition{} 37 | err := c.rancherClient.doCreate(STATE_TRANSITION_TYPE, container, resp) 38 | return resp, err 39 | } 40 | 41 | func (c *StateTransitionClient) Update(existing *StateTransition, updates interface{}) (*StateTransition, error) { 42 | resp := &StateTransition{} 43 | err := c.rancherClient.doUpdate(STATE_TRANSITION_TYPE, &existing.Resource, updates, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *StateTransitionClient) List(opts *ListOpts) (*StateTransitionCollection, error) { 48 | resp := &StateTransitionCollection{} 49 | err := c.rancherClient.doList(STATE_TRANSITION_TYPE, opts, resp) 50 | resp.client = c 51 | return resp, err 52 | } 53 | 54 | func (cc *StateTransitionCollection) Next() (*StateTransitionCollection, error) { 55 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 56 | resp := &StateTransitionCollection{} 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 *StateTransitionClient) ById(id string) (*StateTransition, error) { 65 | resp := &StateTransition{} 66 | err := c.rancherClient.doById(STATE_TRANSITION_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 *StateTransitionClient) Delete(container *StateTransition) error { 76 | return c.rancherClient.doResourceDelete(STATE_TRANSITION_TYPE, &container.Resource) 77 | } 78 | -------------------------------------------------------------------------------- /v2/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 | Token string `json:"token,omitempty" yaml:"token,omitempty"` 11 | 12 | Url string `json:"url,omitempty" yaml:"url,omitempty"` 13 | } 14 | 15 | type StatsAccessCollection struct { 16 | Collection 17 | Data []StatsAccess `json:"data,omitempty"` 18 | client *StatsAccessClient 19 | } 20 | 21 | type StatsAccessClient struct { 22 | rancherClient *RancherClient 23 | } 24 | 25 | type StatsAccessOperations interface { 26 | List(opts *ListOpts) (*StatsAccessCollection, error) 27 | Create(opts *StatsAccess) (*StatsAccess, error) 28 | Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) 29 | ById(id string) (*StatsAccess, error) 30 | Delete(container *StatsAccess) error 31 | } 32 | 33 | func newStatsAccessClient(rancherClient *RancherClient) *StatsAccessClient { 34 | return &StatsAccessClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *StatsAccessClient) Create(container *StatsAccess) (*StatsAccess, error) { 40 | resp := &StatsAccess{} 41 | err := c.rancherClient.doCreate(STATS_ACCESS_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *StatsAccessClient) Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) { 46 | resp := &StatsAccess{} 47 | err := c.rancherClient.doUpdate(STATS_ACCESS_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *StatsAccessClient) List(opts *ListOpts) (*StatsAccessCollection, error) { 52 | resp := &StatsAccessCollection{} 53 | err := c.rancherClient.doList(STATS_ACCESS_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *StatsAccessCollection) Next() (*StatsAccessCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &StatsAccessCollection{} 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 *StatsAccessClient) ById(id string) (*StatsAccess, error) { 69 | resp := &StatsAccess{} 70 | err := c.rancherClient.doById(STATS_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 *StatsAccessClient) Delete(container *StatsAccess) error { 80 | return c.rancherClient.doResourceDelete(STATS_ACCESS_TYPE, &container.Resource) 81 | } 82 | -------------------------------------------------------------------------------- /v2/generated_task.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | TASK_TYPE = "task" 5 | ) 6 | 7 | type Task struct { 8 | Resource 9 | 10 | Name string `json:"name,omitempty" yaml:"name,omitempty"` 11 | } 12 | 13 | type TaskCollection struct { 14 | Collection 15 | Data []Task `json:"data,omitempty"` 16 | client *TaskClient 17 | } 18 | 19 | type TaskClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type TaskOperations interface { 24 | List(opts *ListOpts) (*TaskCollection, error) 25 | Create(opts *Task) (*Task, error) 26 | Update(existing *Task, updates interface{}) (*Task, error) 27 | ById(id string) (*Task, error) 28 | Delete(container *Task) error 29 | 30 | ActionExecute(*Task) (*Task, error) 31 | } 32 | 33 | func newTaskClient(rancherClient *RancherClient) *TaskClient { 34 | return &TaskClient{ 35 | rancherClient: rancherClient, 36 | } 37 | } 38 | 39 | func (c *TaskClient) Create(container *Task) (*Task, error) { 40 | resp := &Task{} 41 | err := c.rancherClient.doCreate(TASK_TYPE, container, resp) 42 | return resp, err 43 | } 44 | 45 | func (c *TaskClient) Update(existing *Task, updates interface{}) (*Task, error) { 46 | resp := &Task{} 47 | err := c.rancherClient.doUpdate(TASK_TYPE, &existing.Resource, updates, resp) 48 | return resp, err 49 | } 50 | 51 | func (c *TaskClient) List(opts *ListOpts) (*TaskCollection, error) { 52 | resp := &TaskCollection{} 53 | err := c.rancherClient.doList(TASK_TYPE, opts, resp) 54 | resp.client = c 55 | return resp, err 56 | } 57 | 58 | func (cc *TaskCollection) Next() (*TaskCollection, error) { 59 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 60 | resp := &TaskCollection{} 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 *TaskClient) ById(id string) (*Task, error) { 69 | resp := &Task{} 70 | err := c.rancherClient.doById(TASK_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 *TaskClient) Delete(container *Task) error { 80 | return c.rancherClient.doResourceDelete(TASK_TYPE, &container.Resource) 81 | } 82 | 83 | func (c *TaskClient) ActionExecute(resource *Task) (*Task, error) { 84 | 85 | resp := &Task{} 86 | 87 | err := c.rancherClient.doAction(TASK_TYPE, "execute", &resource.Resource, nil, resp) 88 | 89 | return resp, err 90 | } 91 | -------------------------------------------------------------------------------- /v2/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /v3/generated_compose_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | COMPOSE_CONFIG_TYPE = "composeConfig" 5 | ) 6 | 7 | type ComposeConfig struct { 8 | Resource `yaml:"-"` 9 | 10 | Templates map[string]string `json:"templates,omitempty" yaml:"templates,omitempty"` 11 | } 12 | 13 | type ComposeConfigCollection struct { 14 | Collection 15 | Data []ComposeConfig `json:"data,omitempty"` 16 | client *ComposeConfigClient 17 | } 18 | 19 | type ComposeConfigClient struct { 20 | rancherClient *RancherClient 21 | } 22 | 23 | type ComposeConfigOperations interface { 24 | List(opts *ListOpts) (*ComposeConfigCollection, error) 25 | Create(opts *ComposeConfig) (*ComposeConfig, error) 26 | Update(existing *ComposeConfig, updates interface{}) (*ComposeConfig, error) 27 | ById(id string) (*ComposeConfig, error) 28 | Delete(container *ComposeConfig) error 29 | } 30 | 31 | func newComposeConfigClient(rancherClient *RancherClient) *ComposeConfigClient { 32 | return &ComposeConfigClient{ 33 | rancherClient: rancherClient, 34 | } 35 | } 36 | 37 | func (c *ComposeConfigClient) Create(container *ComposeConfig) (*ComposeConfig, error) { 38 | resp := &ComposeConfig{} 39 | err := c.rancherClient.doCreate(COMPOSE_CONFIG_TYPE, container, resp) 40 | return resp, err 41 | } 42 | 43 | func (c *ComposeConfigClient) Update(existing *ComposeConfig, updates interface{}) (*ComposeConfig, error) { 44 | resp := &ComposeConfig{} 45 | err := c.rancherClient.doUpdate(COMPOSE_CONFIG_TYPE, &existing.Resource, updates, resp) 46 | return resp, err 47 | } 48 | 49 | func (c *ComposeConfigClient) List(opts *ListOpts) (*ComposeConfigCollection, error) { 50 | resp := &ComposeConfigCollection{} 51 | err := c.rancherClient.doList(COMPOSE_CONFIG_TYPE, opts, resp) 52 | resp.client = c 53 | return resp, err 54 | } 55 | 56 | func (cc *ComposeConfigCollection) Next() (*ComposeConfigCollection, error) { 57 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 58 | resp := &ComposeConfigCollection{} 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 *ComposeConfigClient) ById(id string) (*ComposeConfig, error) { 67 | resp := &ComposeConfig{} 68 | err := c.rancherClient.doById(COMPOSE_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 *ComposeConfigClient) Delete(container *ComposeConfig) error { 78 | return c.rancherClient.doResourceDelete(COMPOSE_CONFIG_TYPE, &container.Resource) 79 | } 80 | -------------------------------------------------------------------------------- /v3/generated_container_logs.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | CONTAINER_LOGS_TYPE = "containerLogs" 5 | ) 6 | 7 | type ContainerLogs struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_depends_on.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | DEPENDS_ON_TYPE = "dependsOn" 5 | ) 6 | 7 | type DependsOn struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_dial.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | DIAL_TYPE = "dial" 5 | ) 6 | 7 | type Dial struct { 8 | Resource `yaml:"-"` 9 | 10 | Address string `json:"address,omitempty" yaml:"address,omitempty"` 11 | 12 | ClusterId string `json:"clusterId,omitempty" yaml:"cluster_id,omitempty"` 13 | 14 | Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"` 15 | } 16 | 17 | type DialCollection struct { 18 | Collection 19 | Data []Dial `json:"data,omitempty"` 20 | client *DialClient 21 | } 22 | 23 | type DialClient struct { 24 | rancherClient *RancherClient 25 | } 26 | 27 | type DialOperations interface { 28 | List(opts *ListOpts) (*DialCollection, error) 29 | Create(opts *Dial) (*Dial, error) 30 | Update(existing *Dial, updates interface{}) (*Dial, error) 31 | ById(id string) (*Dial, error) 32 | Delete(container *Dial) error 33 | } 34 | 35 | func newDialClient(rancherClient *RancherClient) *DialClient { 36 | return &DialClient{ 37 | rancherClient: rancherClient, 38 | } 39 | } 40 | 41 | func (c *DialClient) Create(container *Dial) (*Dial, error) { 42 | resp := &Dial{} 43 | err := c.rancherClient.doCreate(DIAL_TYPE, container, resp) 44 | return resp, err 45 | } 46 | 47 | func (c *DialClient) Update(existing *Dial, updates interface{}) (*Dial, error) { 48 | resp := &Dial{} 49 | err := c.rancherClient.doUpdate(DIAL_TYPE, &existing.Resource, updates, resp) 50 | return resp, err 51 | } 52 | 53 | func (c *DialClient) List(opts *ListOpts) (*DialCollection, error) { 54 | resp := &DialCollection{} 55 | err := c.rancherClient.doList(DIAL_TYPE, opts, resp) 56 | resp.client = c 57 | return resp, err 58 | } 59 | 60 | func (cc *DialCollection) Next() (*DialCollection, error) { 61 | if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { 62 | resp := &DialCollection{} 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 *DialClient) ById(id string) (*Dial, error) { 71 | resp := &Dial{} 72 | err := c.rancherClient.doById(DIAL_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 *DialClient) Delete(container *Dial) error { 82 | return c.rancherClient.doResourceDelete(DIAL_TYPE, &container.Resource) 83 | } 84 | -------------------------------------------------------------------------------- /v3/generated_error.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | ERROR_TYPE = "error" 5 | ) 6 | 7 | type Error struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_host_access.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | HOST_ACCESS_TYPE = "hostAccess" 5 | ) 6 | 7 | type HostAccess struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_instance_remove.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | INSTANCE_REMOVE_TYPE = "instanceRemove" 5 | ) 6 | 7 | type InstanceRemove struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /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 `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_link.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | LINK_TYPE = "link" 5 | ) 6 | 7 | type Link struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_log_config.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | LOG_CONFIG_TYPE = "logConfig" 5 | ) 6 | 7 | type LogConfig struct { 8 | Resource `yaml:"-"` 9 | 10 | Config map[string]string `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 | -------------------------------------------------------------------------------- /v3/generated_service_rollback.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_ROLLBACK_TYPE = "serviceRollback" 5 | ) 6 | 7 | type ServiceRollback struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_service_upgrade.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SERVICE_UPGRADE_TYPE = "serviceUpgrade" 5 | ) 6 | 7 | type ServiceUpgrade struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_setting.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SETTING_TYPE = "setting" 5 | ) 6 | 7 | type Setting struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_stack_upgrade.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STACK_UPGRADE_TYPE = "stackUpgrade" 5 | ) 6 | 7 | type StackUpgrade struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_stats_access.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | STATS_ACCESS_TYPE = "statsAccess" 5 | ) 6 | 7 | type StatsAccess struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_subscribe.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | SUBSCRIBE_TYPE = "subscribe" 5 | ) 6 | 7 | type Subscribe struct { 8 | Resource `yaml:"-"` 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 | -------------------------------------------------------------------------------- /v3/generated_ulimit.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | const ( 4 | ULIMIT_TYPE = "ulimit" 5 | ) 6 | 7 | type Ulimit struct { 8 | Resource `yaml:"-"` 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/Sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.2 4 | - 1.3 5 | - 1.4 6 | - tip 7 | install: 8 | - go get -t ./... 9 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.7.3 2 | 3 | formatter/\*: allow configuration of timestamp layout 4 | 5 | # 0.7.2 6 | 7 | formatter/text: Add configuration option for time format (#158) 8 | -------------------------------------------------------------------------------- /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/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 | _, ok := data["time"] 35 | if ok { 36 | data["fields.time"] = data["time"] 37 | } 38 | 39 | _, ok = data["msg"] 40 | if ok { 41 | data["fields.msg"] = data["msg"] 42 | } 43 | 44 | _, ok = data["level"] 45 | if ok { 46 | data["fields.level"] = data["level"] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /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 | if f.TimestampFormat == "" { 28 | f.TimestampFormat = DefaultTimestampFormat 29 | } 30 | 31 | data["time"] = entry.Time.Format(f.TimestampFormat) 32 | data["msg"] = entry.Message 33 | data["level"] = entry.Level.String() 34 | 35 | serialized, err := json.Marshal(data) 36 | if err != nil { 37 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 38 | } 39 | return append(serialized, '\n'), nil 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_darwin.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.TIOCGETA 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_freebsd.go: -------------------------------------------------------------------------------- 1 | /* 2 | Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. 3 | */ 4 | package logrus 5 | 6 | import ( 7 | "syscall" 8 | ) 9 | 10 | const ioctlReadTermios = syscall.TIOCGETA 11 | 12 | type Termios struct { 13 | Iflag uint32 14 | Oflag uint32 15 | Cflag uint32 16 | Lflag uint32 17 | Cc [20]uint8 18 | Ispeed uint32 19 | Ospeed uint32 20 | } 21 | -------------------------------------------------------------------------------- /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 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if the given file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stdout 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_openbsd.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "syscall" 4 | 5 | const ioctlReadTermios = syscall.TIOCGETA 6 | 7 | type Termios syscall.Termios 8 | -------------------------------------------------------------------------------- /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 the given file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stdout 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 | reader, writer := io.Pipe() 11 | 12 | go logger.writerScanner(reader) 13 | runtime.SetFinalizer(writer, writerFinalizer) 14 | 15 | return writer 16 | } 17 | 18 | func (logger *Logger) writerScanner(reader *io.PipeReader) { 19 | scanner := bufio.NewScanner(reader) 20 | for scanner.Scan() { 21 | logger.Print(scanner.Text()) 22 | } 23 | if err := scanner.Err(); err != nil { 24 | logger.Errorf("Error while reading from Writer: %s", err) 25 | } 26 | reader.Close() 27 | } 28 | 29 | func writerFinalizer(writer *io.PipeWriter) { 30 | writer.Close() 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - 1.3 8 | - 1.4 9 | - tip 10 | -------------------------------------------------------------------------------- /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/mux/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - tip 8 | -------------------------------------------------------------------------------- /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/README.md: -------------------------------------------------------------------------------- 1 | mux 2 | === 3 | [![Build Status](https://travis-ci.org/gorilla/mux.png?branch=master)](https://travis-ci.org/gorilla/mux) 4 | 5 | gorilla/mux is a powerful URL router and dispatcher. 6 | 7 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/mux 8 | -------------------------------------------------------------------------------- /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/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.2 7 | - tip 8 | 9 | script: 10 | - go test -v ./... 11 | -------------------------------------------------------------------------------- /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/gopkg.in/yaml.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | - 1.5 6 | - 1.6 7 | - tip 8 | 9 | go_import_path: gopkg.in/yaml.v2 10 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /vnext/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 | GetTypes() map[string]Schema 28 | 29 | doGet(string, *ListOpts, interface{}) error 30 | doList(string, *ListOpts, interface{}) error 31 | doNext(string, interface{}) error 32 | doModify(string, string, interface{}, interface{}) error 33 | doCreate(string, interface{}, interface{}) error 34 | doUpdate(string, *Resource, interface{}, interface{}) error 35 | doById(string, string, interface{}) error 36 | doResourceDelete(string, *Resource) error 37 | doAction(string, string, *Resource, interface{}, interface{}) error 38 | } 39 | --------------------------------------------------------------------------------