From d62d2f36284a92b284de902b3fffcc7b69439602 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 18 Feb 2024 08:32:00 +0000 Subject: [PATCH] fix(deps): update patch digest dependencies --- go.mod | 39 +- go.sum | 35 + vendor/github.com/Sirupsen/logrus/.gitignore | 1 + vendor/github.com/Sirupsen/logrus/.travis.yml | 13 + .../github.com/Sirupsen/logrus/CHANGELOG.md | 123 ++++ .../copystructure => Sirupsen/logrus}/LICENSE | 2 +- vendor/github.com/Sirupsen/logrus/README.md | 461 +++++++++++++ vendor/github.com/Sirupsen/logrus/alt_exit.go | 64 ++ .../github.com/Sirupsen/logrus/appveyor.yml | 14 + vendor/github.com/Sirupsen/logrus/doc.go | 26 + vendor/github.com/Sirupsen/logrus/entry.go | 300 +++++++++ vendor/github.com/Sirupsen/logrus/exported.go | 201 ++++++ .../github.com/Sirupsen/logrus/formatter.go | 51 ++ vendor/github.com/Sirupsen/logrus/hooks.go | 34 + .../Sirupsen/logrus/json_formatter.go | 89 +++ vendor/github.com/Sirupsen/logrus/logger.go | 337 ++++++++++ vendor/github.com/Sirupsen/logrus/logrus.go | 143 ++++ .../Sirupsen/logrus/terminal_bsd.go | 10 + .../logrus/terminal_check_appengine.go | 11 + .../logrus/terminal_check_notappengine.go | 19 + .../Sirupsen/logrus/terminal_linux.go | 14 + .../Sirupsen/logrus/text_formatter.go | 195 ++++++ vendor/github.com/Sirupsen/logrus/writer.go | 62 ++ .../golang/protobuf/ptypes/empty/empty.pb.go | 62 -- .../github.com/gorilla/handlers/.editorconfig | 20 + vendor/github.com/gorilla/handlers/.gitignore | 2 + vendor/github.com/gorilla/handlers/LICENSE | 39 +- vendor/github.com/gorilla/handlers/Makefile | 34 + vendor/github.com/gorilla/handlers/README.md | 8 +- .../github.com/gorilla/handlers/canonical.go | 9 +- .../github.com/gorilla/handlers/compress.go | 8 +- vendor/github.com/gorilla/handlers/cors.go | 41 +- .../github.com/gorilla/handlers/handlers.go | 15 +- vendor/github.com/gorilla/handlers/logging.go | 32 +- .../gorilla/handlers/proxy_headers.go | 16 +- .../github.com/gorilla/handlers/recovery.go | 22 +- vendor/github.com/gorilla/mux/.editorconfig | 20 + vendor/github.com/gorilla/mux/.gitignore | 1 + vendor/github.com/gorilla/mux/AUTHORS | 8 - vendor/github.com/gorilla/mux/LICENSE | 2 +- vendor/github.com/gorilla/mux/Makefile | 34 + vendor/github.com/gorilla/mux/README.md | 61 +- vendor/github.com/gorilla/mux/doc.go | 25 +- vendor/github.com/gorilla/mux/mux.go | 16 +- vendor/github.com/gorilla/mux/regexp.go | 10 +- vendor/github.com/gorilla/mux/route.go | 109 +-- .../gorilla/websocket/.editorconfig | 20 + .../github.com/gorilla/websocket/.gitignore | 26 +- .../gorilla/websocket/.golangci.yml | 3 + vendor/github.com/gorilla/websocket/AUTHORS | 9 - vendor/github.com/gorilla/websocket/LICENSE | 39 +- vendor/github.com/gorilla/websocket/Makefile | 34 + vendor/github.com/gorilla/websocket/README.md | 19 +- vendor/github.com/gorilla/websocket/client.go | 44 +- .../gorilla/websocket/compression.go | 9 +- vendor/github.com/gorilla/websocket/conn.go | 83 ++- vendor/github.com/gorilla/websocket/mask.go | 4 + vendor/github.com/gorilla/websocket/proxy.go | 17 +- vendor/github.com/gorilla/websocket/server.go | 42 +- .../gorilla/websocket/tls_handshake.go | 3 - .../gorilla/websocket/tls_handshake_116.go | 21 - vendor/github.com/gorilla/websocket/util.go | 19 +- .../gorilla/websocket/x_net_proxy.go | 473 ------------- .../github.com/longhorn/backupstore/config.go | 22 + .../longhorn/backupstore/deltablock.go | 11 + .../longhorn-share-manager/pkg/rpc/server.go | 12 +- .../mitchellh/copystructure/README.md | 21 - .../mitchellh/copystructure/copier_time.go | 15 - .../mitchellh/copystructure/copystructure.go | 631 ------------------ .../mitchellh/reflectwalk/.travis.yml | 1 - .../github.com/mitchellh/reflectwalk/LICENSE | 21 - .../mitchellh/reflectwalk/README.md | 6 - .../mitchellh/reflectwalk/location.go | 19 - .../mitchellh/reflectwalk/location_string.go | 16 - .../mitchellh/reflectwalk/reflectwalk.go | 420 ------------ .../github.com/rancher/go-rancher/api/api.go | 54 +- .../rancher/go-rancher/api/handler.go | 44 +- .../rancher/go-rancher/api/reader.go | 8 - .../github.com/rancher/go-rancher/api/url.go | 6 +- .../rancher/go-rancher/api/writer.go | 36 +- .../rancher/go-rancher/client/types.go | 8 - .../rancher/go-rancher/v2/client.go | 39 ++ .../rancher/go-rancher/v2/common.go | 629 +++++++++++++++++ .../go-rancher/v2/generated_account.go | 186 ++++++ .../go-rancher/v2/generated_active_setting.go | 87 +++ .../v2/generated_add_outputs_input.go | 79 +++ ...generated_add_remove_service_link_input.go | 79 +++ .../rancher/go-rancher/v2/generated_agent.go | 206 ++++++ .../v2/generated_amazonec2config.go | 137 ++++ .../go-rancher/v2/generated_api_key.go | 173 +++++ .../go-rancher/v2/generated_audit_log.go | 105 +++ .../go-rancher/v2/generated_azure_config.go | 121 ++++ .../go-rancher/v2/generated_azureadconfig.go | 93 +++ .../rancher/go-rancher/v2/generated_backup.go | 133 ++++ .../go-rancher/v2/generated_backup_target.go | 127 ++++ .../v2/generated_base_machine_config.go | 77 +++ .../go-rancher/v2/generated_binding.go | 79 +++ .../v2/generated_blkio_device_option.go | 87 +++ .../v2/generated_catalog_template.go | 93 +++ .../go-rancher/v2/generated_certificate.go | 162 +++++ .../v2/generated_change_secret_input.go | 81 +++ .../rancher/go-rancher/v2/generated_client.go | 353 ++++++++++ .../v2/generated_cluster_membership.go | 87 +++ .../go-rancher/v2/generated_compose_config.go | 81 +++ .../v2/generated_compose_config_input.go | 79 +++ .../v2/generated_compose_project.go | 191 ++++++ .../v2/generated_compose_service.go | 212 ++++++ .../go-rancher/v2/generated_config_item.go | 81 +++ .../v2/generated_config_item_status.go | 93 +++ .../go-rancher/v2/generated_container.go | 517 ++++++++++++++ .../v2/generated_container_event.go | 129 ++++ .../go-rancher/v2/generated_container_exec.go | 85 +++ .../go-rancher/v2/generated_container_logs.go | 81 +++ .../v2/generated_container_proxy.go | 81 +++ .../go-rancher/v2/generated_credential.go | 173 +++++ .../v2/generated_databasechangelog.go | 97 +++ .../v2/generated_databasechangeloglock.go | 83 +++ .../v2/generated_default_network.go | 183 +++++ .../v2/generated_digitalocean_config.go | 101 +++ .../go-rancher/v2/generated_dns_service.go | 285 ++++++++ .../go-rancher/v2/generated_docker_build.go | 89 +++ .../v2/generated_extension_implementation.go | 83 +++ .../v2/generated_extension_point.go | 87 +++ .../v2/generated_external_dns_event.go | 129 ++++ .../go-rancher/v2/generated_external_event.go | 123 ++++ .../v2/generated_external_handler.go | 175 +++++ ...al_handler_external_handler_process_map.go | 175 +++++ .../v2/generated_external_handler_process.go | 167 +++++ ...nerated_external_handler_process_config.go | 81 +++ .../v2/generated_external_host_event.go | 129 ++++ .../v2/generated_external_service.go | 252 +++++++ .../v2/generated_external_service_event.go | 127 ++++ .../generated_external_storage_pool_event.go | 127 ++++ .../v2/generated_external_volume_event.go | 125 ++++ .../v2/generated_field_documentation.go | 79 +++ .../go-rancher/v2/generated_generic_object.go | 129 ++++ .../go-rancher/v2/generated_ha_config.go | 85 +++ .../v2/generated_ha_config_input.go | 109 +++ ...generated_healthcheck_instance_host_map.go | 131 ++++ .../rancher/go-rancher/v2/generated_host.go | 275 ++++++++ .../go-rancher/v2/generated_host_access.go | 81 +++ .../v2/generated_host_api_proxy_token.go | 83 +++ .../go-rancher/v2/generated_host_template.go | 133 ++++ .../go-rancher/v2/generated_identity.go | 97 +++ .../rancher/go-rancher/v2/generated_image.go | 169 +++++ .../generated_in_service_upgrade_strategy.go | 91 +++ .../go-rancher/v2/generated_instance.go | 272 ++++++++ .../v2/generated_instance_console.go | 83 +++ .../v2/generated_instance_console_input.go | 77 +++ .../v2/generated_instance_health_check.go | 99 +++ .../go-rancher/v2/generated_instance_link.go | 177 +++++ .../go-rancher/v2/generated_instance_stop.go | 81 +++ .../go-rancher/v2/generated_ip_address.go | 195 ++++++ .../v2/generated_kubernetes_service.go | 275 ++++++++ .../v2/generated_kubernetes_stack.go | 204 ++++++ .../v2/generated_kubernetes_stack_upgrade.go | 85 +++ .../rancher/go-rancher/v2/generated_label.go | 129 ++++ .../go-rancher/v2/generated_launch_config.go | 518 ++++++++++++++ .../go-rancher/v2/generated_lb_config.go | 87 +++ .../v2/generated_lb_target_config.go | 79 +++ ..._load_balancer_cookie_stickiness_policy.go | 91 +++ .../v2/generated_load_balancer_service.go | 297 +++++++++ .../v2/generated_local_auth_config.go | 87 +++ .../go-rancher/v2/generated_log_config.go | 81 +++ .../go-rancher/v2/generated_machine.go | 194 ++++++ .../go-rancher/v2/generated_machine_driver.go | 192 ++++++ .../rancher/go-rancher/v2/generated_mount.go | 144 ++++ .../go-rancher/v2/generated_mount_entry.go | 87 +++ .../go-rancher/v2/generated_network.go | 185 +++++ .../go-rancher/v2/generated_network_driver.go | 166 +++++ .../v2/generated_network_driver_service.go | 305 +++++++++ .../v2/generated_network_policy_rule.go | 89 +++ .../generated_network_policy_rule_between.go | 81 +++ .../generated_network_policy_rule_member.go | 79 +++ .../generated_network_policy_rule_within.go | 77 +++ .../go-rancher/v2/generated_nfs_config.go | 83 +++ .../go-rancher/v2/generated_openldapconfig.go | 129 ++++ .../go-rancher/v2/generated_packet_config.go | 89 +++ .../go-rancher/v2/generated_password.go | 184 +++++ .../go-rancher/v2/generated_physical_host.go | 162 +++++ .../rancher/go-rancher/v2/generated_port.go | 183 +++++ .../go-rancher/v2/generated_port_rule.go | 101 +++ .../v2/generated_process_definition.go | 91 +++ .../v2/generated_process_execution.go | 85 +++ .../v2/generated_process_instance.go | 118 ++++ .../go-rancher/v2/generated_process_pool.go | 95 +++ .../v2/generated_process_summary.go | 85 +++ .../go-rancher/v2/generated_project.go | 211 ++++++ .../go-rancher/v2/generated_project_member.go | 175 +++++ .../v2/generated_project_template.go | 131 ++++ .../v2/generated_public_endpoint.go | 87 +++ .../go-rancher/v2/generated_publish.go | 99 +++ .../go-rancher/v2/generated_pull_task.go | 133 ++++ ...ated_recreate_on_quorum_strategy_config.go | 79 +++ .../go-rancher/v2/generated_register.go | 144 ++++ .../v2/generated_registration_token.go | 177 +++++ .../go-rancher/v2/generated_registry.go | 181 +++++ .../v2/generated_registry_credential.go | 175 +++++ .../v2/generated_resource_definition.go | 79 +++ .../go-rancher/v2/generated_restart_policy.go | 81 +++ .../v2/generated_restore_from_backup_input.go | 79 +++ .../v2/generated_revert_to_snapshot_input.go | 79 +++ .../v2/generated_rolling_restart_strategy.go | 81 +++ .../go-rancher/v2/generated_scale_policy.go | 83 +++ .../v2/generated_scheduled_upgrade.go | 136 ++++ .../v2/generated_secondary_launch_config.go | 520 +++++++++++++++ .../rancher/go-rancher/v2/generated_secret.go | 127 ++++ .../v2/generated_secret_reference.go | 87 +++ .../go-rancher/v2/generated_service.go | 303 +++++++++ .../v2/generated_service_binding.go | 81 +++ .../v2/generated_service_consume_map.go | 142 ++++ .../go-rancher/v2/generated_service_event.go | 135 ++++ .../v2/generated_service_expose_map.go | 133 ++++ .../go-rancher/v2/generated_service_link.go | 85 +++ .../go-rancher/v2/generated_service_log.go | 101 +++ .../go-rancher/v2/generated_service_proxy.go | 87 +++ .../v2/generated_service_restart.go | 79 +++ .../v2/generated_service_upgrade.go | 81 +++ .../v2/generated_service_upgrade_strategy.go | 81 +++ .../v2/generated_services_port_range.go | 81 +++ .../v2/generated_set_project_members_input.go | 79 +++ .../v2/generated_set_service_links_input.go | 79 +++ .../go-rancher/v2/generated_setting.go | 87 +++ .../go-rancher/v2/generated_snapshot.go | 138 ++++ .../v2/generated_snapshot_backup_input.go | 107 +++ .../rancher/go-rancher/v2/generated_stack.go | 265 ++++++++ .../go-rancher/v2/generated_stack_upgrade.go | 89 +++ .../v2/generated_state_transition.go | 77 +++ .../go-rancher/v2/generated_stats_access.go | 81 +++ .../go-rancher/v2/generated_storage_driver.go | 168 +++++ .../v2/generated_storage_driver_service.go | 305 +++++++++ .../go-rancher/v2/generated_storage_pool.go | 185 +++++ .../rancher/go-rancher/v2/generated_subnet.go | 181 +++++ .../v2/generated_target_port_rule.go | 85 +++ .../rancher/go-rancher/v2/generated_task.go | 90 +++ .../go-rancher/v2/generated_task_instance.go | 89 +++ .../generated_to_service_upgrade_strategy.go | 87 +++ .../v2/generated_type_documentation.go | 81 +++ .../rancher/go-rancher/v2/generated_ulimit.go | 83 +++ .../v2/generated_user_preference.go | 173 +++++ .../v2/generated_virtual_machine.go | 485 ++++++++++++++ .../v2/generated_virtual_machine_disk.go | 91 +++ .../rancher/go-rancher/v2/generated_volume.go | 230 +++++++ .../v2/generated_volume_activate_input.go | 79 +++ .../v2/generated_volume_snapshot_input.go | 79 +++ .../v2/generated_volume_template.go | 179 +++++ .../rancher/go-rancher/v2/schemas.go | 131 ++++ .../github.com/rancher/go-rancher/v2/types.go | 95 +++ .../rancher/wrangler/pkg/apply/desiredset.go | 36 +- .../wrangler/pkg/apply/desiredset_apply.go | 5 +- .../wrangler/pkg/apply/desiredset_process.go | 56 +- .../v1/customresourcedefinition.go | 49 +- .../apiregistration.k8s.io/v1/apiservice.go | 49 +- .../controllers/apps/v1/daemonset.go | 49 +- .../controllers/apps/v1/deployment.go | 49 +- .../controllers/apps/v1/statefulset.go | 49 +- .../pkg/generated/controllers/batch/v1/job.go | 49 +- .../controllers/core/v1/namespace.go | 49 +- .../pkg/generated/controllers/core/v1/node.go | 49 +- .../controllers/core/v1/persistentvolume.go | 49 +- .../core/v1/persistentvolumeclaim.go | 49 +- .../pkg/generated/controllers/core/v1/pod.go | 49 +- .../generated/controllers/core/v1/service.go | 49 +- .../wrangler/pkg/generic/generating.go | 2 + .../rancher/wrangler/pkg/signals/signal.go | 2 +- .../wrangler/pkg/signals/signal_posix.go | 1 + .../x/crypto/ssh/terminal/terminal.go | 76 +++ vendor/k8s.io/utils/integer/integer.go | 8 +- vendor/k8s.io/utils/pointer/pointer.go | 283 ++------ vendor/k8s.io/utils/ptr/OWNERS | 10 + vendor/k8s.io/utils/ptr/README.md | 3 + vendor/k8s.io/utils/ptr/ptr.go | 73 ++ vendor/modules.txt | 53 +- 273 files changed, 27076 insertions(+), 2422 deletions(-) create mode 100644 vendor/github.com/Sirupsen/logrus/.gitignore create mode 100644 vendor/github.com/Sirupsen/logrus/.travis.yml create mode 100644 vendor/github.com/Sirupsen/logrus/CHANGELOG.md rename vendor/github.com/{mitchellh/copystructure => Sirupsen/logrus}/LICENSE (96%) create mode 100644 vendor/github.com/Sirupsen/logrus/README.md create mode 100644 vendor/github.com/Sirupsen/logrus/alt_exit.go create mode 100644 vendor/github.com/Sirupsen/logrus/appveyor.yml create mode 100644 vendor/github.com/Sirupsen/logrus/doc.go create mode 100644 vendor/github.com/Sirupsen/logrus/entry.go create mode 100644 vendor/github.com/Sirupsen/logrus/exported.go create mode 100644 vendor/github.com/Sirupsen/logrus/formatter.go create mode 100644 vendor/github.com/Sirupsen/logrus/hooks.go create mode 100644 vendor/github.com/Sirupsen/logrus/json_formatter.go create mode 100644 vendor/github.com/Sirupsen/logrus/logger.go create mode 100644 vendor/github.com/Sirupsen/logrus/logrus.go create mode 100644 vendor/github.com/Sirupsen/logrus/terminal_bsd.go create mode 100644 vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go create mode 100644 vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go create mode 100644 vendor/github.com/Sirupsen/logrus/terminal_linux.go create mode 100644 vendor/github.com/Sirupsen/logrus/text_formatter.go create mode 100644 vendor/github.com/Sirupsen/logrus/writer.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go create mode 100644 vendor/github.com/gorilla/handlers/.editorconfig create mode 100644 vendor/github.com/gorilla/handlers/.gitignore create mode 100644 vendor/github.com/gorilla/handlers/Makefile create mode 100644 vendor/github.com/gorilla/mux/.editorconfig create mode 100644 vendor/github.com/gorilla/mux/.gitignore delete mode 100644 vendor/github.com/gorilla/mux/AUTHORS create mode 100644 vendor/github.com/gorilla/mux/Makefile create mode 100644 vendor/github.com/gorilla/websocket/.editorconfig create mode 100644 vendor/github.com/gorilla/websocket/.golangci.yml delete mode 100644 vendor/github.com/gorilla/websocket/AUTHORS create mode 100644 vendor/github.com/gorilla/websocket/Makefile delete mode 100644 vendor/github.com/gorilla/websocket/tls_handshake_116.go delete mode 100644 vendor/github.com/gorilla/websocket/x_net_proxy.go delete mode 100644 vendor/github.com/mitchellh/copystructure/README.md delete mode 100644 vendor/github.com/mitchellh/copystructure/copier_time.go delete mode 100644 vendor/github.com/mitchellh/copystructure/copystructure.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/.travis.yml delete mode 100644 vendor/github.com/mitchellh/reflectwalk/LICENSE delete mode 100644 vendor/github.com/mitchellh/reflectwalk/README.md delete mode 100644 vendor/github.com/mitchellh/reflectwalk/location.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/location_string.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/reflectwalk.go delete mode 100644 vendor/github.com/rancher/go-rancher/api/reader.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/client.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/common.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_account.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_active_setting.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_add_outputs_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_add_remove_service_link_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_agent.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_amazonec2config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_api_key.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_audit_log.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_azure_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_azureadconfig.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_backup.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_backup_target.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_base_machine_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_binding.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_blkio_device_option.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_catalog_template.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_certificate.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_change_secret_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_client.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_cluster_membership.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_compose_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_compose_config_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_compose_project.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_compose_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_config_item.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_config_item_status.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_container.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_container_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_container_exec.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_container_logs.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_container_proxy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_credential.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_databasechangelog.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_databasechangeloglock.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_default_network.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_digitalocean_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_dns_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_docker_build.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_extension_implementation.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_extension_point.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_dns_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_handler.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_handler_external_handler_process_map.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_host_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_service_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_storage_pool_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_external_volume_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_field_documentation.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_generic_object.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_ha_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_ha_config_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_healthcheck_instance_host_map.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_host.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_host_access.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_host_api_proxy_token.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_host_template.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_identity.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_image.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_in_service_upgrade_strategy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_instance.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_instance_console.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_instance_console_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_instance_health_check.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_instance_link.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_instance_stop.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_ip_address.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack_upgrade.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_label.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_launch_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_lb_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_lb_target_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_cookie_stickiness_policy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_local_auth_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_log_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_machine.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_machine_driver.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_mount.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_mount_entry.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network_driver.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network_driver_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_between.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_member.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_within.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_nfs_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_openldapconfig.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_packet_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_password.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_physical_host.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_port.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_port_rule.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_process_definition.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_process_execution.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_process_instance.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_process_pool.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_process_summary.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_project.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_project_member.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_project_template.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_public_endpoint.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_publish.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_pull_task.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_recreate_on_quorum_strategy_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_register.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_registration_token.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_registry.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_registry_credential.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_resource_definition.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_restart_policy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_restore_from_backup_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_revert_to_snapshot_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_rolling_restart_strategy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_scale_policy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_scheduled_upgrade.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_secondary_launch_config.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_secret.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_secret_reference.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_binding.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_consume_map.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_event.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_expose_map.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_link.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_log.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_proxy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_restart.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade_strategy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_services_port_range.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_set_project_members_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_set_service_links_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_setting.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_snapshot.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_snapshot_backup_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_stack.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_stack_upgrade.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_state_transition.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_stats_access.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_storage_driver.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_storage_driver_service.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_storage_pool.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_subnet.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_target_port_rule.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_task.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_task_instance.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_to_service_upgrade_strategy.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_type_documentation.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_ulimit.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_user_preference.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine_disk.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_volume.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_volume_activate_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_volume_snapshot_input.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/generated_volume_template.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/schemas.go create mode 100644 vendor/github.com/rancher/go-rancher/v2/types.go create mode 100644 vendor/golang.org/x/crypto/ssh/terminal/terminal.go create mode 100644 vendor/k8s.io/utils/ptr/OWNERS create mode 100644 vendor/k8s.io/utils/ptr/README.md create mode 100644 vendor/k8s.io/utils/ptr/ptr.go diff --git a/go.mod b/go.mod index a83ace2892..fc6c522e59 100644 --- a/go.mod +++ b/go.mod @@ -38,28 +38,28 @@ require ( github.com/container-storage-interface/spec v1.8.0 github.com/docker/go-connections v0.4.0 github.com/google/uuid v1.5.0 - github.com/gorilla/handlers v1.5.1 - github.com/gorilla/mux v1.8.0 - github.com/gorilla/websocket v1.5.0 + github.com/gorilla/handlers v1.5.2 + github.com/gorilla/mux v1.8.1 + github.com/gorilla/websocket v1.5.1 github.com/jinzhu/copier v0.3.5 github.com/kubernetes-csi/csi-lib-utils v0.6.1 - github.com/longhorn/backing-image-manager v1.6.0-dev-20231217.0.20240103150452-7f8aea1edd03 - github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b - github.com/longhorn/go-common-libs v0.0.0-20240109042507-23627e6416b7 - github.com/longhorn/go-iscsi-helper v0.0.0-20240103085736-72aee873888a - github.com/longhorn/go-spdk-helper v0.0.0-20240117135122-26f8acb2a13d - github.com/longhorn/longhorn-engine v1.6.0-dev-20240105.0.20240110095344-deb8b18a1558 - github.com/longhorn/longhorn-instance-manager v1.6.0-rc2.0.20240126090453-5a27dd0e4a81 - github.com/longhorn/longhorn-share-manager v1.6.0-dev-20231217.0.20231226052309-99d57c1695ea + github.com/longhorn/backing-image-manager v1.6.0 + github.com/longhorn/backupstore v0.0.0-20240207150630-b375644f1c57 + github.com/longhorn/go-common-libs v0.0.0-20240207153251-d5e1ceae50ac + github.com/longhorn/go-iscsi-helper v0.0.0-20240207150711-0713d1c9f5d1 + github.com/longhorn/go-spdk-helper v0.0.0-20240207162828-b64c3bc30abe + github.com/longhorn/longhorn-engine v1.6.0 + github.com/longhorn/longhorn-instance-manager v1.6.0 + github.com/longhorn/longhorn-share-manager v1.6.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 github.com/rancher/dynamiclistener v0.3.6 - github.com/rancher/go-rancher v0.1.1-0.20220412083059-ff12399dd57b - github.com/rancher/wrangler v1.1.1 + github.com/rancher/go-rancher v0.1.1-0.20200505164325-7577995d47c0 + github.com/rancher/wrangler v1.1.2 github.com/robfig/cron v1.2.0 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 - github.com/urfave/cli v1.22.13 + github.com/urfave/cli v1.22.14 golang.org/x/mod v0.13.0 golang.org/x/net v0.20.0 golang.org/x/sys v0.16.0 @@ -67,19 +67,20 @@ require ( google.golang.org/grpc v1.60.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.28.5 + k8s.io/api v0.28.6 k8s.io/apiextensions-apiserver v0.25.4 - k8s.io/apimachinery v0.28.5 + k8s.io/apimachinery v0.28.6 k8s.io/cli-runtime v0.28.5 - k8s.io/client-go v0.28.5 + k8s.io/client-go v0.28.6 k8s.io/kubernetes v1.28.5 k8s.io/metrics v0.28.5 k8s.io/mount-utils v0.28.5 - k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 + k8s.io/utils v0.0.0-20240102154912-e7106e64919e sigs.k8s.io/controller-runtime v0.10.1 ) require ( + github.com/Sirupsen/logrus v1.0.6 // indirect github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect @@ -159,7 +160,7 @@ require ( github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 + github.com/rancher/lasso v0.0.0-20240123150939-7055397d6dfa github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect diff --git a/go.sum b/go.sum index a2ad9d458e..9e872edb2c 100644 --- a/go.sum +++ b/go.sum @@ -604,6 +604,7 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= @@ -614,6 +615,8 @@ github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMo github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/RoaringBitmap/roaring v1.2.3 h1:yqreLINqIrX22ErkKI0vY47/ivtJr6n+kMhVOVmhWBY= github.com/RoaringBitmap/roaring v1.2.3/go.mod h1:plvDsJQpxOC5bw8LRteu/MLWHsHez/3y6cubLI4/1yE= +github.com/Sirupsen/logrus v1.0.6 h1:HCAGQRk48dRVPA5Y+Yh0qdCSTzPOyU1tBJ7Q9YzotII= +github.com/Sirupsen/logrus v1.0.6/go.mod h1:rmk17hk6i8ZSAJkSDa7nOxamrG+SP4P0mm+DAvExv4U= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -946,11 +949,17 @@ github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8 github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= @@ -1041,20 +1050,36 @@ github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhn github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/longhorn/backing-image-manager v1.6.0-dev-20231217.0.20240103150452-7f8aea1edd03 h1:ZsWbMHBwM+fFewUunuyX8WlkAahL44qfbEUcHd73wmI= github.com/longhorn/backing-image-manager v1.6.0-dev-20231217.0.20240103150452-7f8aea1edd03/go.mod h1:IH0mgbK+Dr13xkY+LhDaufyd9YIpiKqYo1AeRLFYGrk= +github.com/longhorn/backing-image-manager v1.6.0 h1:Jmlc8+W63l0VZoVhPwNLniAk+eBC4CNaadoqpqA51KE= +github.com/longhorn/backing-image-manager v1.6.0/go.mod h1:IH0mgbK+Dr13xkY+LhDaufyd9YIpiKqYo1AeRLFYGrk= github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b h1:euBbfDb6bnp8KQ5qmbvWWEG7KP6nxhUotLCPGU/x3v0= github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b/go.mod h1:4cbJWtlrD2cGTQxQLtdlPTYopiJiusXH7CpOBrn/s3k= +github.com/longhorn/backupstore v0.0.0-20240207150630-b375644f1c57 h1:4yP0EwQ3tmTwOws1hXa5T5QxtDyibwKaFNocgLHyrjU= +github.com/longhorn/backupstore v0.0.0-20240207150630-b375644f1c57/go.mod h1:4cbJWtlrD2cGTQxQLtdlPTYopiJiusXH7CpOBrn/s3k= github.com/longhorn/go-common-libs v0.0.0-20240109042507-23627e6416b7 h1:t8F+BjCcn0qqHdVlGktqnEH5EOGigFnAFmVbQPe0nnY= github.com/longhorn/go-common-libs v0.0.0-20240109042507-23627e6416b7/go.mod h1:nIECQARppamt2zwFSdzADRTVKo/7izFwWIS3VWi7D/s= +github.com/longhorn/go-common-libs v0.0.0-20240207153251-d5e1ceae50ac h1:Nz/fI1xZHmywhoQtgYCVA3m298wPGY7Mub6Od88WGoA= +github.com/longhorn/go-common-libs v0.0.0-20240207153251-d5e1ceae50ac/go.mod h1:nIECQARppamt2zwFSdzADRTVKo/7izFwWIS3VWi7D/s= github.com/longhorn/go-iscsi-helper v0.0.0-20240103085736-72aee873888a h1:2MoRekaOOLU77EgqxGO/XEff2UlktC9mGnxE4rVAOgs= github.com/longhorn/go-iscsi-helper v0.0.0-20240103085736-72aee873888a/go.mod h1:f5kDYhd77SGeNesKSzAlSmbEsTTf3xPUZDuLkoq7uxE= +github.com/longhorn/go-iscsi-helper v0.0.0-20240207150711-0713d1c9f5d1 h1:72o4pevKg52zzEIjxMJGtyOIe7dp0th64swIH447cNU= +github.com/longhorn/go-iscsi-helper v0.0.0-20240207150711-0713d1c9f5d1/go.mod h1:f5kDYhd77SGeNesKSzAlSmbEsTTf3xPUZDuLkoq7uxE= github.com/longhorn/go-spdk-helper v0.0.0-20240117135122-26f8acb2a13d h1:Yqt7DL478ir9LwHmuRRXWzKKyzKbvPkGadCeRQ3pv1o= github.com/longhorn/go-spdk-helper v0.0.0-20240117135122-26f8acb2a13d/go.mod h1:9nZ5HbwviggK6l792X4l9fTivEWmiK3sXFaroiRp2yw= +github.com/longhorn/go-spdk-helper v0.0.0-20240207162828-b64c3bc30abe h1:JZEOvy9esoYuJFHKfw1B3OJRGqXrQS3rxIx8m6ZZReg= +github.com/longhorn/go-spdk-helper v0.0.0-20240207162828-b64c3bc30abe/go.mod h1:9nZ5HbwviggK6l792X4l9fTivEWmiK3sXFaroiRp2yw= github.com/longhorn/longhorn-engine v1.6.0-dev-20240105.0.20240110095344-deb8b18a1558 h1:j2fUmyqimKGakd5WNf46bfgZV4q5IsgKzcl/oP7QRoA= github.com/longhorn/longhorn-engine v1.6.0-dev-20240105.0.20240110095344-deb8b18a1558/go.mod h1:xRX2tg6Xaer0OonBnqA0wCruk/j51w3izR2J1+xHfiI= +github.com/longhorn/longhorn-engine v1.6.0 h1:6CH2vvwCgFBIGW4TegcI79CL1Ego1nvLZIC3ioRjjdM= +github.com/longhorn/longhorn-engine v1.6.0/go.mod h1:Snkv3gy4AUOhZSYMI7g7lVX/OOB8DTo28eJwsEfbAwM= github.com/longhorn/longhorn-instance-manager v1.6.0-rc2.0.20240126090453-5a27dd0e4a81 h1:VPGzIU7jv40X5zEBU947CdqxwV5N0e1PBhC+S7ty2cA= github.com/longhorn/longhorn-instance-manager v1.6.0-rc2.0.20240126090453-5a27dd0e4a81/go.mod h1:ry4Ewu9vQVOFSIraAzxEyw0kUaDpbLLbOcFYUaEIrB0= +github.com/longhorn/longhorn-instance-manager v1.6.0 h1:xwY4+adOnOed5GDIkUuKb6REYIG4YeW+G7HNEc71QjI= +github.com/longhorn/longhorn-instance-manager v1.6.0/go.mod h1:XKGvL+p67XI7gLPJJY0M1MlcE2i7eT66tpjtSUm8VJE= github.com/longhorn/longhorn-share-manager v1.6.0-dev-20231217.0.20231226052309-99d57c1695ea h1:bYNEyl0yAh76fjzTQEo7+u2G80XaVi8aXfMlwyPiZmI= github.com/longhorn/longhorn-share-manager v1.6.0-dev-20231217.0.20231226052309-99d57c1695ea/go.mod h1:sDo6d4FV5nALnXkZHRY31H6R6KTK0LNo0kMVULlhYiE= +github.com/longhorn/longhorn-share-manager v1.6.0 h1:rmvwCWOeADdf67uw5Dsv7m5m0aFbIxERNk0rYl3DuVk= +github.com/longhorn/longhorn-share-manager v1.6.0/go.mod h1:akAmB/ZKonalweOYEhbg85X2vhAz+/sMzg779EFgPO8= github.com/longhorn/longhorn-spdk-engine v0.0.0-20240123044045-c5f14845bd83 h1:7onMWr23AzUC6C7uSpe0lfi0J2FPhrxtExGlYEyFCxc= github.com/longhorn/longhorn-spdk-engine v0.0.0-20240123044045-c5f14845bd83/go.mod h1:+qobpc6BOqFxXjyEksxuSjfSI6BEJF7L630GWP9wyOk= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= @@ -1219,12 +1244,18 @@ github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rancher/dynamiclistener v0.3.6 h1:iAFWeiFNra6tYlt4k+jINrK3hOxZ8mjW2S/9nA6sxKs= github.com/rancher/dynamiclistener v0.3.6/go.mod h1:VqBaJNi+bZmre0+gi+2Jb6jbn7ovHzRueW+M7QhVKsk= +github.com/rancher/go-rancher v0.1.1-0.20200505164325-7577995d47c0 h1:eN7OjoV17Vg/+uQSUlESSEvXXFKdmzM2kR7PTNJR9z4= +github.com/rancher/go-rancher v0.1.1-0.20200505164325-7577995d47c0/go.mod h1:7oQvGNiJsGvrUgB+7AH8bmdzuR0uhULfwKb43Ht0hUk= github.com/rancher/go-rancher v0.1.1-0.20220412083059-ff12399dd57b h1:so40GMVZOZkQeIbAzaZRq6wDrMErvRLuXNsGTRZUpg8= github.com/rancher/go-rancher v0.1.1-0.20220412083059-ff12399dd57b/go.mod h1:7oQvGNiJsGvrUgB+7AH8bmdzuR0uhULfwKb43Ht0hUk= github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 h1:+kige/h8/LnzWgPjB5NUIHz/pWiW/lFpqcTUkN5uulY= github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29/go.mod h1:kgk9kJVMj9FIrrXU0iyM6u/9Je4bEjPImqswkTVaKsQ= +github.com/rancher/lasso v0.0.0-20240123150939-7055397d6dfa h1:eRhvQJjIpPxJunlS3e1J3qTghUy9MIrMjQa2aXYSC3k= +github.com/rancher/lasso v0.0.0-20240123150939-7055397d6dfa/go.mod h1:utdskbIL7kdVvPCUFPEJQDWJwPHGFpUCRfVkX2G2Xxg= github.com/rancher/wrangler v1.1.1 h1:wmqUwqc2M7ADfXnBCJTFkTB5ZREWpD78rnZMzmxwMvM= github.com/rancher/wrangler v1.1.1/go.mod h1:ioVbKupzcBOdzsl55MvEDN0R1wdGggj8iNCYGFI5JvM= +github.com/rancher/wrangler v1.1.2 h1:oXbXo9k7y/H4drUpb4RM1c++vT9O3rpoNEfyusGykiU= +github.com/rancher/wrangler v1.1.2/go.mod h1:2k9MyhlBdjcutcBGoOJSUAz0HgDAXnMjv81d3n/AaQc= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= @@ -1310,6 +1341,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1 github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.13 h1:wsLILXG8qCJNse/qAgLNf23737Cx05GflHg/PJGe1Ok= github.com/urfave/cli v1.22.13/go.mod h1:VufqObjsMTF2BBwKawpx9R8eAneNEWhoO0yx8Vd+FkE= +github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= +github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= @@ -2221,6 +2254,8 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= diff --git a/vendor/github.com/Sirupsen/logrus/.gitignore b/vendor/github.com/Sirupsen/logrus/.gitignore new file mode 100644 index 0000000000..66be63a005 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/.gitignore @@ -0,0 +1 @@ +logrus diff --git a/vendor/github.com/Sirupsen/logrus/.travis.yml b/vendor/github.com/Sirupsen/logrus/.travis.yml new file mode 100644 index 0000000000..2f19b4a757 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/.travis.yml @@ -0,0 +1,13 @@ +language: go +go: + - 1.9.x + - 1.10.x +env: + - GOMAXPROCS=4 GORACE=halt_on_error=1 +install: + - go get github.com/stretchr/testify/assert + - go get gopkg.in/gemnasium/logrus-airbrake-hook.v2 + - go get golang.org/x/sys/unix + - go get golang.org/x/sys/windows +script: + - go test -race -v ./... diff --git a/vendor/github.com/Sirupsen/logrus/CHANGELOG.md b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md new file mode 100644 index 0000000000..1bd1deb294 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md @@ -0,0 +1,123 @@ +# 1.0.5 + +* Fix hooks race (#707) +* Fix panic deadlock (#695) + +# 1.0.4 + +* Fix race when adding hooks (#612) +* Fix terminal check in AppEngine (#635) + +# 1.0.3 + +* Replace example files with testable examples + +# 1.0.2 + +* bug: quote non-string values in text formatter (#583) +* Make (*Logger) SetLevel a public method + +# 1.0.1 + +* bug: fix escaping in text formatter (#575) + +# 1.0.0 + +* Officially changed name to lower-case +* bug: colors on Windows 10 (#541) +* bug: fix race in accessing level (#512) + +# 0.11.5 + +* feature: add writer and writerlevel to entry (#372) + +# 0.11.4 + +* bug: fix undefined variable on solaris (#493) + +# 0.11.3 + +* formatter: configure quoting of empty values (#484) +* formatter: configure quoting character (default is `"`) (#484) +* bug: fix not importing io correctly in non-linux environments (#481) + +# 0.11.2 + +* bug: fix windows terminal detection (#476) + +# 0.11.1 + +* bug: fix tty detection with custom out (#471) + +# 0.11.0 + +* performance: Use bufferpool to allocate (#370) +* terminal: terminal detection for app-engine (#343) +* feature: exit handler (#375) + +# 0.10.0 + +* feature: Add a test hook (#180) +* feature: `ParseLevel` is now case-insensitive (#326) +* feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308) +* performance: avoid re-allocations on `WithFields` (#335) + +# 0.9.0 + +* logrus/text_formatter: don't emit empty msg +* logrus/hooks/airbrake: move out of main repository +* logrus/hooks/sentry: move out of main repository +* logrus/hooks/papertrail: move out of main repository +* logrus/hooks/bugsnag: move out of main repository +* logrus/core: run tests with `-race` +* logrus/core: detect TTY based on `stderr` +* logrus/core: support `WithError` on logger +* logrus/core: Solaris support + +# 0.8.7 + +* logrus/core: fix possible race (#216) +* logrus/doc: small typo fixes and doc improvements + + +# 0.8.6 + +* hooks/raven: allow passing an initialized client + +# 0.8.5 + +* logrus/core: revert #208 + +# 0.8.4 + +* formatter/text: fix data race (#218) + +# 0.8.3 + +* logrus/core: fix entry log level (#208) +* logrus/core: improve performance of text formatter by 40% +* logrus/core: expose `LevelHooks` type +* logrus/core: add support for DragonflyBSD and NetBSD +* formatter/text: print structs more verbosely + +# 0.8.2 + +* logrus: fix more Fatal family functions + +# 0.8.1 + +* logrus: fix not exiting on `Fatalf` and `Fatalln` + +# 0.8.0 + +* logrus: defaults to stderr instead of stdout +* hooks/sentry: add special field for `*http.Request` +* formatter/text: ignore Windows for colors + +# 0.7.3 + +* formatter/\*: allow configuration of timestamp layout + +# 0.7.2 + +* formatter/text: Add configuration option for time format (#158) diff --git a/vendor/github.com/mitchellh/copystructure/LICENSE b/vendor/github.com/Sirupsen/logrus/LICENSE similarity index 96% rename from vendor/github.com/mitchellh/copystructure/LICENSE rename to vendor/github.com/Sirupsen/logrus/LICENSE index 2298515904..f090cb42f3 100644 --- a/vendor/github.com/mitchellh/copystructure/LICENSE +++ b/vendor/github.com/Sirupsen/logrus/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Mitchell Hashimoto +Copyright (c) 2014 Simon Eskildsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/github.com/Sirupsen/logrus/README.md b/vendor/github.com/Sirupsen/logrus/README.md new file mode 100644 index 0000000000..072e99be31 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/README.md @@ -0,0 +1,461 @@ +# Logrus :walrus: [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/sirupsen/logrus?status.svg)](https://godoc.org/github.com/sirupsen/logrus) + +Logrus is a structured logger for Go (golang), completely API compatible with +the standard library logger. + +**Seeing weird case-sensitive problems?** It's in the past been possible to +import Logrus as both upper- and lower-case. Due to the Go package environment, +this caused issues in the community and we needed a standard. Some environments +experienced problems with the upper-case variant, so the lower-case was decided. +Everything using `logrus` will need to use the lower-case: +`github.com/sirupsen/logrus`. Any package that isn't, should be changed. + +To fix Glide, see [these +comments](https://github.com/sirupsen/logrus/issues/553#issuecomment-306591437). +For an in-depth explanation of the casing issue, see [this +comment](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276). + +**Are you interested in assisting in maintaining Logrus?** Currently I have a +lot of obligations, and I am unable to provide Logrus with the maintainership it +needs. If you'd like to help, please reach out to me at `simon at author's +username dot com`. + +Nicely color-coded in development (when a TTY is attached, otherwise just +plain text): + +![Colored](http://i.imgur.com/PY7qMwd.png) + +With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash +or Splunk: + +```json +{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the +ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"} + +{"level":"warning","msg":"The group's number increased tremendously!", +"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"} + +{"animal":"walrus","level":"info","msg":"A giant walrus appears!", +"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"} + +{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.", +"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"} + +{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true, +"time":"2014-03-10 19:57:38.562543128 -0400 EDT"} +``` + +With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not +attached, the output is compatible with the +[logfmt](http://godoc.org/github.com/kr/logfmt) format: + +```text +time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8 +time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10 +time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true +time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4 +time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009 +time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true +exit status 1 +``` + +#### Case-sensitivity + +The organization's name was changed to lower-case--and this will not be changed +back. If you are getting import conflicts due to case sensitivity, please use +the lower-case import: `github.com/sirupsen/logrus`. + +#### Example + +The simplest way to use Logrus is simply the package-level exported logger: + +```go +package main + +import ( + log "github.com/sirupsen/logrus" +) + +func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + }).Info("A walrus appears") +} +``` + +Note that it's completely api-compatible with the stdlib logger, so you can +replace your `log` imports everywhere with `log "github.com/sirupsen/logrus"` +and you'll now have the flexibility of Logrus. You can customize it all you +want: + +```go +package main + +import ( + "os" + log "github.com/sirupsen/logrus" +) + +func init() { + // Log as JSON instead of the default ASCII formatter. + log.SetFormatter(&log.JSONFormatter{}) + + // Output to stdout instead of the default stderr + // Can be any io.Writer, see below for File example + log.SetOutput(os.Stdout) + + // Only log the warning severity or above. + log.SetLevel(log.WarnLevel) +} + +func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + "size": 10, + }).Info("A group of walrus emerges from the ocean") + + log.WithFields(log.Fields{ + "omg": true, + "number": 122, + }).Warn("The group's number increased tremendously!") + + log.WithFields(log.Fields{ + "omg": true, + "number": 100, + }).Fatal("The ice breaks!") + + // A common pattern is to re-use fields between logging statements by re-using + // the logrus.Entry returned from WithFields() + contextLogger := log.WithFields(log.Fields{ + "common": "this is a common field", + "other": "I also should be logged always", + }) + + contextLogger.Info("I'll be logged with common and other field") + contextLogger.Info("Me too") +} +``` + +For more advanced usage such as logging to multiple locations from the same +application, you can also create an instance of the `logrus` Logger: + +```go +package main + +import ( + "os" + "github.com/sirupsen/logrus" +) + +// Create a new instance of the logger. You can have any number of instances. +var log = logrus.New() + +func main() { + // The API for setting attributes is a little different than the package level + // exported logger. See Godoc. + log.Out = os.Stdout + + // You could set this to any `io.Writer` such as a file + // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666) + // if err == nil { + // log.Out = file + // } else { + // log.Info("Failed to log to file, using default stderr") + // } + + log.WithFields(logrus.Fields{ + "animal": "walrus", + "size": 10, + }).Info("A group of walrus emerges from the ocean") +} +``` + +#### Fields + +Logrus encourages careful, structured logging through logging fields instead of +long, unparseable error messages. For example, instead of: `log.Fatalf("Failed +to send event %s to topic %s with key %d")`, you should log the much more +discoverable: + +```go +log.WithFields(log.Fields{ + "event": event, + "topic": topic, + "key": key, +}).Fatal("Failed to send event") +``` + +We've found this API forces you to think about logging in a way that produces +much more useful logging messages. We've been in countless situations where just +a single added field to a log statement that was already there would've saved us +hours. The `WithFields` call is optional. + +In general, with Logrus using any of the `printf`-family functions should be +seen as a hint you should add a field, however, you can still use the +`printf`-family functions with Logrus. + +#### Default Fields + +Often it's helpful to have fields _always_ attached to log statements in an +application or parts of one. For example, you may want to always log the +`request_id` and `user_ip` in the context of a request. Instead of writing +`log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})` on +every line, you can create a `logrus.Entry` to pass around instead: + +```go +requestLogger := log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip}) +requestLogger.Info("something happened on that request") # will log request_id and user_ip +requestLogger.Warn("something not great happened") +``` + +#### Hooks + +You can add hooks for logging levels. For example to send errors to an exception +tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to +multiple places simultaneously, e.g. syslog. + +Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in +`init`: + +```go +import ( + log "github.com/sirupsen/logrus" + "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "airbrake" + logrus_syslog "github.com/sirupsen/logrus/hooks/syslog" + "log/syslog" +) + +func init() { + + // Use the Airbrake hook to report errors that have Error severity or above to + // an exception tracker. You can create custom hooks, see the Hooks section. + log.AddHook(airbrake.NewHook(123, "xyz", "production")) + + hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + if err != nil { + log.Error("Unable to connect to local syslog daemon") + } else { + log.AddHook(hook) + } +} +``` +Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md). + +A list of currently known of service hook can be found in this wiki [page](https://github.com/sirupsen/logrus/wiki/Hooks) + + +#### Level logging + +Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic. + +```go +log.Debug("Useful debugging information.") +log.Info("Something noteworthy happened!") +log.Warn("You should probably take a look at this.") +log.Error("Something failed but I'm not quitting.") +// Calls os.Exit(1) after logging +log.Fatal("Bye.") +// Calls panic() after logging +log.Panic("I'm bailing.") +``` + +You can set the logging level on a `Logger`, then it will only log entries with +that severity or anything above it: + +```go +// Will log anything that is info or above (warn, error, fatal, panic). Default. +log.SetLevel(log.InfoLevel) +``` + +It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose +environment if your application has that. + +#### Entries + +Besides the fields added with `WithField` or `WithFields` some fields are +automatically added to all logging events: + +1. `time`. The timestamp when the entry was created. +2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after + the `AddFields` call. E.g. `Failed to send event.` +3. `level`. The logging level. E.g. `info`. + +#### Environments + +Logrus has no notion of environment. + +If you wish for hooks and formatters to only be used in specific environments, +you should handle that yourself. For example, if your application has a global +variable `Environment`, which is a string representation of the environment you +could do: + +```go +import ( + log "github.com/sirupsen/logrus" +) + +init() { + // do something here to set environment depending on an environment variable + // or command-line flag + if Environment == "production" { + log.SetFormatter(&log.JSONFormatter{}) + } else { + // The TextFormatter is default, you don't actually have to do this. + log.SetFormatter(&log.TextFormatter{}) + } +} +``` + +This configuration is how `logrus` was intended to be used, but JSON in +production is mostly only useful if you do log aggregation with tools like +Splunk or Logstash. + +#### Formatters + +The built-in logging formatters are: + +* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise + without colors. + * *Note:* to force colored output when there is no TTY, set the `ForceColors` + field to `true`. To force no colored output even if there is a TTY set the + `DisableColors` field to `true`. For Windows, see + [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable). + * When colors are enabled, levels are truncated to 4 characters by default. To disable + truncation set the `DisableLevelTruncation` field to `true`. + * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter). +* `logrus.JSONFormatter`. Logs fields as JSON. + * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter). + +Third party logging formatters: + +* [`FluentdFormatter`](https://github.com/joonix/log). Formats entries that can be parsed by Kubernetes and Google Container Engine. +* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events. +* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout. +* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦. + +You can define your formatter by implementing the `Formatter` interface, +requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a +`Fields` type (`map[string]interface{}`) with all your fields as well as the +default ones (see Entries section above): + +```go +type MyJSONFormatter struct { +} + +log.SetFormatter(new(MyJSONFormatter)) + +func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) { + // Note this doesn't include Time, Level and Message which are available on + // the Entry. Consult `godoc` on information about those fields or read the + // source of the official loggers. + serialized, err := json.Marshal(entry.Data) + if err != nil { + return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) + } + return append(serialized, '\n'), nil +} +``` + +#### Logger as an `io.Writer` + +Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it. + +```go +w := logger.Writer() +defer w.Close() + +srv := http.Server{ + // create a stdlib log.Logger that writes to + // logrus.Logger. + ErrorLog: log.New(w, "", 0), +} +``` + +Each line written to that writer will be printed the usual way, using formatters +and hooks. The level for those entries is `info`. + +This means that we can override the standard library logger easily: + +```go +logger := logrus.New() +logger.Formatter = &logrus.JSONFormatter{} + +// Use logrus for standard log output +// Note that `log` here references stdlib's log +// Not logrus imported under the name `log`. +log.SetOutput(logger.Writer()) +``` + +#### Rotation + +Log rotation is not provided with Logrus. Log rotation should be done by an +external program (like `logrotate(8)`) that can compress and delete old log +entries. It should not be a feature of the application-level logger. + +#### Tools + +| Tool | Description | +| ---- | ----------- | +|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.| +|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) | + +#### Testing + +Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides: + +* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook +* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any): + +```go +import( + "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus/hooks/test" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestSomething(t*testing.T){ + logger, hook := test.NewNullLogger() + logger.Error("Helloerror") + + assert.Equal(t, 1, len(hook.Entries)) + assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level) + assert.Equal(t, "Helloerror", hook.LastEntry().Message) + + hook.Reset() + assert.Nil(t, hook.LastEntry()) +} +``` + +#### Fatal handlers + +Logrus can register one or more functions that will be called when any `fatal` +level message is logged. The registered handlers will be executed before +logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need +to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted. + +``` +... +handler := func() { + // gracefully shutdown something... +} +logrus.RegisterExitHandler(handler) +... +``` + +#### Thread safety + +By default, Logger is protected by a mutex for concurrent writes. The mutex is held when calling hooks and writing logs. +If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking. + +Situation when locking is not needed includes: + +* You have no hooks registered, or hooks calling is already thread-safe. + +* Writing to logger.Out is already thread-safe, for example: + + 1) logger.Out is protected by locks. + + 2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing) + + (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/) diff --git a/vendor/github.com/Sirupsen/logrus/alt_exit.go b/vendor/github.com/Sirupsen/logrus/alt_exit.go new file mode 100644 index 0000000000..8af90637a9 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/alt_exit.go @@ -0,0 +1,64 @@ +package logrus + +// The following code was sourced and modified from the +// https://github.com/tebeka/atexit package governed by the following license: +// +// Copyright (c) 2012 Miki Tebeka . +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +import ( + "fmt" + "os" +) + +var handlers = []func(){} + +func runHandler(handler func()) { + defer func() { + if err := recover(); err != nil { + fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err) + } + }() + + handler() +} + +func runHandlers() { + for _, handler := range handlers { + runHandler(handler) + } +} + +// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code) +func Exit(code int) { + runHandlers() + os.Exit(code) +} + +// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke +// all handlers. The handlers will also be invoked when any Fatal log entry is +// made. +// +// This method is useful when a caller wishes to use logrus to log a fatal +// message but also needs to gracefully shutdown. An example usecase could be +// closing database connections, or sending a alert that the application is +// closing. +func RegisterExitHandler(handler func()) { + handlers = append(handlers, handler) +} diff --git a/vendor/github.com/Sirupsen/logrus/appveyor.yml b/vendor/github.com/Sirupsen/logrus/appveyor.yml new file mode 100644 index 0000000000..96c2ce15f8 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/appveyor.yml @@ -0,0 +1,14 @@ +version: "{build}" +platform: x64 +clone_folder: c:\gopath\src\github.com\sirupsen\logrus +environment: + GOPATH: c:\gopath +branches: + only: + - master +install: + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - go version +build_script: + - go get -t + - go test diff --git a/vendor/github.com/Sirupsen/logrus/doc.go b/vendor/github.com/Sirupsen/logrus/doc.go new file mode 100644 index 0000000000..da67aba06d --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/doc.go @@ -0,0 +1,26 @@ +/* +Package logrus is a structured logger for Go, completely API compatible with the standard library logger. + + +The simplest way to use Logrus is simply the package-level exported logger: + + package main + + import ( + log "github.com/sirupsen/logrus" + ) + + func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + "number": 1, + "size": 10, + }).Info("A walrus appears") + } + +Output: + time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 + +For a full guide visit https://github.com/sirupsen/logrus +*/ +package logrus diff --git a/vendor/github.com/Sirupsen/logrus/entry.go b/vendor/github.com/Sirupsen/logrus/entry.go new file mode 100644 index 0000000000..473bd1a0d3 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/entry.go @@ -0,0 +1,300 @@ +package logrus + +import ( + "bytes" + "fmt" + "os" + "sync" + "time" +) + +var bufferPool *sync.Pool + +func init() { + bufferPool = &sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, + } +} + +// Defines the key when adding errors using WithError. +var ErrorKey = "error" + +// An entry is the final or intermediate Logrus logging entry. It contains all +// the fields passed with WithField{,s}. It's finally logged when Debug, Info, +// Warn, Error, Fatal or Panic is called on it. These objects can be reused and +// passed around as much as you wish to avoid field duplication. +type Entry struct { + Logger *Logger + + // Contains all the fields set by the user. + Data Fields + + // Time at which the log entry was created + Time time.Time + + // Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic + // This field will be set on entry firing and the value will be equal to the one in Logger struct field. + Level Level + + // Message passed to Debug, Info, Warn, Error, Fatal or Panic + Message string + + // When formatter is called in entry.log(), an Buffer may be set to entry + Buffer *bytes.Buffer +} + +func NewEntry(logger *Logger) *Entry { + return &Entry{ + Logger: logger, + // Default is five fields, give a little extra room + Data: make(Fields, 5), + } +} + +// Returns the string representation from the reader and ultimately the +// formatter. +func (entry *Entry) String() (string, error) { + serialized, err := entry.Logger.Formatter.Format(entry) + if err != nil { + return "", err + } + str := string(serialized) + return str, nil +} + +// Add an error as single field (using the key defined in ErrorKey) to the Entry. +func (entry *Entry) WithError(err error) *Entry { + return entry.WithField(ErrorKey, err) +} + +// Add a single field to the Entry. +func (entry *Entry) WithField(key string, value interface{}) *Entry { + return entry.WithFields(Fields{key: value}) +} + +// Add a map of fields to the Entry. +func (entry *Entry) WithFields(fields Fields) *Entry { + data := make(Fields, len(entry.Data)+len(fields)) + for k, v := range entry.Data { + data[k] = v + } + for k, v := range fields { + data[k] = v + } + return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time} +} + +// Overrides the time of the Entry. +func (entry *Entry) WithTime(t time.Time) *Entry { + return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t} +} + +// This function is not declared with a pointer value because otherwise +// race conditions will occur when using multiple goroutines +func (entry Entry) log(level Level, msg string) { + var buffer *bytes.Buffer + + // Default to now, but allow users to override if they want. + // + // We don't have to worry about polluting future calls to Entry#log() + // with this assignment because this function is declared with a + // non-pointer receiver. + if entry.Time.IsZero() { + entry.Time = time.Now() + } + + entry.Level = level + entry.Message = msg + + entry.fireHooks() + + buffer = bufferPool.Get().(*bytes.Buffer) + buffer.Reset() + defer bufferPool.Put(buffer) + entry.Buffer = buffer + + entry.write() + + entry.Buffer = nil + + // To avoid Entry#log() returning a value that only would make sense for + // panic() to use in Entry#Panic(), we avoid the allocation by checking + // directly here. + if level <= PanicLevel { + panic(&entry) + } +} + +func (entry *Entry) fireHooks() { + entry.Logger.mu.Lock() + defer entry.Logger.mu.Unlock() + err := entry.Logger.Hooks.Fire(entry.Level, entry) + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err) + } +} + +func (entry *Entry) write() { + serialized, err := entry.Logger.Formatter.Format(entry) + entry.Logger.mu.Lock() + defer entry.Logger.mu.Unlock() + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err) + } else { + _, err = entry.Logger.Out.Write(serialized) + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) + } + } +} + +func (entry *Entry) Debug(args ...interface{}) { + if entry.Logger.level() >= DebugLevel { + entry.log(DebugLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Print(args ...interface{}) { + entry.Info(args...) +} + +func (entry *Entry) Info(args ...interface{}) { + if entry.Logger.level() >= InfoLevel { + entry.log(InfoLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Warn(args ...interface{}) { + if entry.Logger.level() >= WarnLevel { + entry.log(WarnLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Warning(args ...interface{}) { + entry.Warn(args...) +} + +func (entry *Entry) Error(args ...interface{}) { + if entry.Logger.level() >= ErrorLevel { + entry.log(ErrorLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Fatal(args ...interface{}) { + if entry.Logger.level() >= FatalLevel { + entry.log(FatalLevel, fmt.Sprint(args...)) + } + Exit(1) +} + +func (entry *Entry) Panic(args ...interface{}) { + if entry.Logger.level() >= PanicLevel { + entry.log(PanicLevel, fmt.Sprint(args...)) + } + panic(fmt.Sprint(args...)) +} + +// Entry Printf family functions + +func (entry *Entry) Debugf(format string, args ...interface{}) { + if entry.Logger.level() >= DebugLevel { + entry.Debug(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Infof(format string, args ...interface{}) { + if entry.Logger.level() >= InfoLevel { + entry.Info(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Printf(format string, args ...interface{}) { + entry.Infof(format, args...) +} + +func (entry *Entry) Warnf(format string, args ...interface{}) { + if entry.Logger.level() >= WarnLevel { + entry.Warn(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Warningf(format string, args ...interface{}) { + entry.Warnf(format, args...) +} + +func (entry *Entry) Errorf(format string, args ...interface{}) { + if entry.Logger.level() >= ErrorLevel { + entry.Error(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Fatalf(format string, args ...interface{}) { + if entry.Logger.level() >= FatalLevel { + entry.Fatal(fmt.Sprintf(format, args...)) + } + Exit(1) +} + +func (entry *Entry) Panicf(format string, args ...interface{}) { + if entry.Logger.level() >= PanicLevel { + entry.Panic(fmt.Sprintf(format, args...)) + } +} + +// Entry Println family functions + +func (entry *Entry) Debugln(args ...interface{}) { + if entry.Logger.level() >= DebugLevel { + entry.Debug(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Infoln(args ...interface{}) { + if entry.Logger.level() >= InfoLevel { + entry.Info(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Println(args ...interface{}) { + entry.Infoln(args...) +} + +func (entry *Entry) Warnln(args ...interface{}) { + if entry.Logger.level() >= WarnLevel { + entry.Warn(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Warningln(args ...interface{}) { + entry.Warnln(args...) +} + +func (entry *Entry) Errorln(args ...interface{}) { + if entry.Logger.level() >= ErrorLevel { + entry.Error(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Fatalln(args ...interface{}) { + if entry.Logger.level() >= FatalLevel { + entry.Fatal(entry.sprintlnn(args...)) + } + Exit(1) +} + +func (entry *Entry) Panicln(args ...interface{}) { + if entry.Logger.level() >= PanicLevel { + entry.Panic(entry.sprintlnn(args...)) + } +} + +// Sprintlnn => Sprint no newline. This is to get the behavior of how +// fmt.Sprintln where spaces are always added between operands, regardless of +// their type. Instead of vendoring the Sprintln implementation to spare a +// string allocation, we do the simplest thing. +func (entry *Entry) sprintlnn(args ...interface{}) string { + msg := fmt.Sprintln(args...) + return msg[:len(msg)-1] +} diff --git a/vendor/github.com/Sirupsen/logrus/exported.go b/vendor/github.com/Sirupsen/logrus/exported.go new file mode 100644 index 0000000000..eb612a6f3e --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/exported.go @@ -0,0 +1,201 @@ +package logrus + +import ( + "io" + "time" +) + +var ( + // std is the name of the standard logger in stdlib `log` + std = New() +) + +func StandardLogger() *Logger { + return std +} + +// SetOutput sets the standard logger output. +func SetOutput(out io.Writer) { + std.SetOutput(out) +} + +// SetFormatter sets the standard logger formatter. +func SetFormatter(formatter Formatter) { + std.mu.Lock() + defer std.mu.Unlock() + std.Formatter = formatter +} + +// SetLevel sets the standard logger level. +func SetLevel(level Level) { + std.mu.Lock() + defer std.mu.Unlock() + std.SetLevel(level) +} + +// GetLevel returns the standard logger level. +func GetLevel() Level { + std.mu.Lock() + defer std.mu.Unlock() + return std.level() +} + +// AddHook adds a hook to the standard logger hooks. +func AddHook(hook Hook) { + std.mu.Lock() + defer std.mu.Unlock() + std.Hooks.Add(hook) +} + +// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key. +func WithError(err error) *Entry { + return std.WithField(ErrorKey, err) +} + +// WithField creates an entry from the standard logger and adds a field to +// it. If you want multiple fields, use `WithFields`. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithField(key string, value interface{}) *Entry { + return std.WithField(key, value) +} + +// WithFields creates an entry from the standard logger and adds multiple +// fields to it. This is simply a helper for `WithField`, invoking it +// once for each field. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithFields(fields Fields) *Entry { + return std.WithFields(fields) +} + +// WithTime creats an entry from the standard logger and overrides the time of +// logs generated with it. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithTime(t time.Time) *Entry { + return std.WithTime(t) +} + +// Debug logs a message at level Debug on the standard logger. +func Debug(args ...interface{}) { + std.Debug(args...) +} + +// Print logs a message at level Info on the standard logger. +func Print(args ...interface{}) { + std.Print(args...) +} + +// Info logs a message at level Info on the standard logger. +func Info(args ...interface{}) { + std.Info(args...) +} + +// Warn logs a message at level Warn on the standard logger. +func Warn(args ...interface{}) { + std.Warn(args...) +} + +// Warning logs a message at level Warn on the standard logger. +func Warning(args ...interface{}) { + std.Warning(args...) +} + +// Error logs a message at level Error on the standard logger. +func Error(args ...interface{}) { + std.Error(args...) +} + +// Panic logs a message at level Panic on the standard logger. +func Panic(args ...interface{}) { + std.Panic(args...) +} + +// Fatal logs a message at level Fatal on the standard logger then the process will exit with status set to 1. +func Fatal(args ...interface{}) { + std.Fatal(args...) +} + +// Debugf logs a message at level Debug on the standard logger. +func Debugf(format string, args ...interface{}) { + std.Debugf(format, args...) +} + +// Printf logs a message at level Info on the standard logger. +func Printf(format string, args ...interface{}) { + std.Printf(format, args...) +} + +// Infof logs a message at level Info on the standard logger. +func Infof(format string, args ...interface{}) { + std.Infof(format, args...) +} + +// Warnf logs a message at level Warn on the standard logger. +func Warnf(format string, args ...interface{}) { + std.Warnf(format, args...) +} + +// Warningf logs a message at level Warn on the standard logger. +func Warningf(format string, args ...interface{}) { + std.Warningf(format, args...) +} + +// Errorf logs a message at level Error on the standard logger. +func Errorf(format string, args ...interface{}) { + std.Errorf(format, args...) +} + +// Panicf logs a message at level Panic on the standard logger. +func Panicf(format string, args ...interface{}) { + std.Panicf(format, args...) +} + +// Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1. +func Fatalf(format string, args ...interface{}) { + std.Fatalf(format, args...) +} + +// Debugln logs a message at level Debug on the standard logger. +func Debugln(args ...interface{}) { + std.Debugln(args...) +} + +// Println logs a message at level Info on the standard logger. +func Println(args ...interface{}) { + std.Println(args...) +} + +// Infoln logs a message at level Info on the standard logger. +func Infoln(args ...interface{}) { + std.Infoln(args...) +} + +// Warnln logs a message at level Warn on the standard logger. +func Warnln(args ...interface{}) { + std.Warnln(args...) +} + +// Warningln logs a message at level Warn on the standard logger. +func Warningln(args ...interface{}) { + std.Warningln(args...) +} + +// Errorln logs a message at level Error on the standard logger. +func Errorln(args ...interface{}) { + std.Errorln(args...) +} + +// Panicln logs a message at level Panic on the standard logger. +func Panicln(args ...interface{}) { + std.Panicln(args...) +} + +// Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1. +func Fatalln(args ...interface{}) { + std.Fatalln(args...) +} diff --git a/vendor/github.com/Sirupsen/logrus/formatter.go b/vendor/github.com/Sirupsen/logrus/formatter.go new file mode 100644 index 0000000000..83c74947be --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/formatter.go @@ -0,0 +1,51 @@ +package logrus + +import "time" + +const defaultTimestampFormat = time.RFC3339 + +// The Formatter interface is used to implement a custom Formatter. It takes an +// `Entry`. It exposes all the fields, including the default ones: +// +// * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. +// * `entry.Data["time"]`. The timestamp. +// * `entry.Data["level"]. The level the entry was logged at. +// +// Any additional fields added with `WithField` or `WithFields` are also in +// `entry.Data`. Format is expected to return an array of bytes which are then +// logged to `logger.Out`. +type Formatter interface { + Format(*Entry) ([]byte, error) +} + +// This is to not silently overwrite `time`, `msg` and `level` fields when +// dumping it. If this code wasn't there doing: +// +// logrus.WithField("level", 1).Info("hello") +// +// Would just silently drop the user provided level. Instead with this code +// it'll logged as: +// +// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} +// +// It's not exported because it's still using Data in an opinionated way. It's to +// avoid code duplication between the two default formatters. +func prefixFieldClashes(data Fields, fieldMap FieldMap) { + timeKey := fieldMap.resolve(FieldKeyTime) + if t, ok := data[timeKey]; ok { + data["fields."+timeKey] = t + delete(data, timeKey) + } + + msgKey := fieldMap.resolve(FieldKeyMsg) + if m, ok := data[msgKey]; ok { + data["fields."+msgKey] = m + delete(data, msgKey) + } + + levelKey := fieldMap.resolve(FieldKeyLevel) + if l, ok := data[levelKey]; ok { + data["fields."+levelKey] = l + delete(data, levelKey) + } +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks.go b/vendor/github.com/Sirupsen/logrus/hooks.go new file mode 100644 index 0000000000..3f151cdc39 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks.go @@ -0,0 +1,34 @@ +package logrus + +// A hook to be fired when logging on the logging levels returned from +// `Levels()` on your implementation of the interface. Note that this is not +// fired in a goroutine or a channel with workers, you should handle such +// functionality yourself if your call is non-blocking and you don't wish for +// the logging calls for levels returned from `Levels()` to block. +type Hook interface { + Levels() []Level + Fire(*Entry) error +} + +// Internal type for storing the hooks on a logger instance. +type LevelHooks map[Level][]Hook + +// Add a hook to an instance of logger. This is called with +// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. +func (hooks LevelHooks) Add(hook Hook) { + for _, level := range hook.Levels() { + hooks[level] = append(hooks[level], hook) + } +} + +// Fire all the hooks for the passed level. Used by `entry.log` to fire +// appropriate hooks for a log entry. +func (hooks LevelHooks) Fire(level Level, entry *Entry) error { + for _, hook := range hooks[level] { + if err := hook.Fire(entry); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/Sirupsen/logrus/json_formatter.go b/vendor/github.com/Sirupsen/logrus/json_formatter.go new file mode 100644 index 0000000000..dab17610f1 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/json_formatter.go @@ -0,0 +1,89 @@ +package logrus + +import ( + "encoding/json" + "fmt" +) + +type fieldKey string + +// FieldMap allows customization of the key names for default fields. +type FieldMap map[fieldKey]string + +// Default key names for the default fields +const ( + FieldKeyMsg = "msg" + FieldKeyLevel = "level" + FieldKeyTime = "time" +) + +func (f FieldMap) resolve(key fieldKey) string { + if k, ok := f[key]; ok { + return k + } + + return string(key) +} + +// JSONFormatter formats logs into parsable json +type JSONFormatter struct { + // TimestampFormat sets the format used for marshaling timestamps. + TimestampFormat string + + // DisableTimestamp allows disabling automatic timestamps in output + DisableTimestamp bool + + // DataKey allows users to put all the log entry parameters into a nested dictionary at a given key. + DataKey string + + // FieldMap allows users to customize the names of keys for default fields. + // As an example: + // formatter := &JSONFormatter{ + // FieldMap: FieldMap{ + // FieldKeyTime: "@timestamp", + // FieldKeyLevel: "@level", + // FieldKeyMsg: "@message", + // }, + // } + FieldMap FieldMap +} + +// Format renders a single log entry +func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { + data := make(Fields, len(entry.Data)+3) + for k, v := range entry.Data { + switch v := v.(type) { + case error: + // Otherwise errors are ignored by `encoding/json` + // https://github.com/sirupsen/logrus/issues/137 + data[k] = v.Error() + default: + data[k] = v + } + } + + if f.DataKey != "" { + newData := make(Fields, 4) + newData[f.DataKey] = data + data = newData + } + + prefixFieldClashes(data, f.FieldMap) + + timestampFormat := f.TimestampFormat + if timestampFormat == "" { + timestampFormat = defaultTimestampFormat + } + + if !f.DisableTimestamp { + data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat) + } + data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message + data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String() + + serialized, err := json.Marshal(data) + if err != nil { + return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) + } + return append(serialized, '\n'), nil +} diff --git a/vendor/github.com/Sirupsen/logrus/logger.go b/vendor/github.com/Sirupsen/logrus/logger.go new file mode 100644 index 0000000000..342f7977d8 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/logger.go @@ -0,0 +1,337 @@ +package logrus + +import ( + "io" + "os" + "sync" + "sync/atomic" + "time" +) + +type Logger struct { + // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a + // file, or leave it default which is `os.Stderr`. You can also set this to + // something more adventorous, such as logging to Kafka. + Out io.Writer + // Hooks for the logger instance. These allow firing events based on logging + // levels and log entries. For example, to send errors to an error tracking + // service, log to StatsD or dump the core on fatal errors. + Hooks LevelHooks + // All log entries pass through the formatter before logged to Out. The + // included formatters are `TextFormatter` and `JSONFormatter` for which + // TextFormatter is the default. In development (when a TTY is attached) it + // logs with colors, but to a file it wouldn't. You can easily implement your + // own that implements the `Formatter` interface, see the `README` or included + // formatters for examples. + Formatter Formatter + // The logging level the logger should log at. This is typically (and defaults + // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be + // logged. + Level Level + // Used to sync writing to the log. Locking is enabled by Default + mu MutexWrap + // Reusable empty entry + entryPool sync.Pool +} + +type MutexWrap struct { + lock sync.Mutex + disabled bool +} + +func (mw *MutexWrap) Lock() { + if !mw.disabled { + mw.lock.Lock() + } +} + +func (mw *MutexWrap) Unlock() { + if !mw.disabled { + mw.lock.Unlock() + } +} + +func (mw *MutexWrap) Disable() { + mw.disabled = true +} + +// Creates a new logger. Configuration should be set by changing `Formatter`, +// `Out` and `Hooks` directly on the default logger instance. You can also just +// instantiate your own: +// +// var log = &Logger{ +// Out: os.Stderr, +// Formatter: new(JSONFormatter), +// Hooks: make(LevelHooks), +// Level: logrus.DebugLevel, +// } +// +// It's recommended to make this a global instance called `log`. +func New() *Logger { + return &Logger{ + Out: os.Stderr, + Formatter: new(TextFormatter), + Hooks: make(LevelHooks), + Level: InfoLevel, + } +} + +func (logger *Logger) newEntry() *Entry { + entry, ok := logger.entryPool.Get().(*Entry) + if ok { + return entry + } + return NewEntry(logger) +} + +func (logger *Logger) releaseEntry(entry *Entry) { + logger.entryPool.Put(entry) +} + +// Adds a field to the log entry, note that it doesn't log until you call +// Debug, Print, Info, Warn, Error, Fatal or Panic. It only creates a log entry. +// If you want multiple fields, use `WithFields`. +func (logger *Logger) WithField(key string, value interface{}) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithField(key, value) +} + +// Adds a struct of fields to the log entry. All it does is call `WithField` for +// each `Field`. +func (logger *Logger) WithFields(fields Fields) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithFields(fields) +} + +// Add an error as single field to the log entry. All it does is call +// `WithError` for the given `error`. +func (logger *Logger) WithError(err error) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithError(err) +} + +// Overrides the time of the log entry. +func (logger *Logger) WithTime(t time.Time) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithTime(t) +} + +func (logger *Logger) Debugf(format string, args ...interface{}) { + if logger.level() >= DebugLevel { + entry := logger.newEntry() + entry.Debugf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Infof(format string, args ...interface{}) { + if logger.level() >= InfoLevel { + entry := logger.newEntry() + entry.Infof(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Printf(format string, args ...interface{}) { + entry := logger.newEntry() + entry.Printf(format, args...) + logger.releaseEntry(entry) +} + +func (logger *Logger) Warnf(format string, args ...interface{}) { + if logger.level() >= WarnLevel { + entry := logger.newEntry() + entry.Warnf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Warningf(format string, args ...interface{}) { + if logger.level() >= WarnLevel { + entry := logger.newEntry() + entry.Warnf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Errorf(format string, args ...interface{}) { + if logger.level() >= ErrorLevel { + entry := logger.newEntry() + entry.Errorf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Fatalf(format string, args ...interface{}) { + if logger.level() >= FatalLevel { + entry := logger.newEntry() + entry.Fatalf(format, args...) + logger.releaseEntry(entry) + } + Exit(1) +} + +func (logger *Logger) Panicf(format string, args ...interface{}) { + if logger.level() >= PanicLevel { + entry := logger.newEntry() + entry.Panicf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Debug(args ...interface{}) { + if logger.level() >= DebugLevel { + entry := logger.newEntry() + entry.Debug(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Info(args ...interface{}) { + if logger.level() >= InfoLevel { + entry := logger.newEntry() + entry.Info(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Print(args ...interface{}) { + entry := logger.newEntry() + entry.Info(args...) + logger.releaseEntry(entry) +} + +func (logger *Logger) Warn(args ...interface{}) { + if logger.level() >= WarnLevel { + entry := logger.newEntry() + entry.Warn(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Warning(args ...interface{}) { + if logger.level() >= WarnLevel { + entry := logger.newEntry() + entry.Warn(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Error(args ...interface{}) { + if logger.level() >= ErrorLevel { + entry := logger.newEntry() + entry.Error(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Fatal(args ...interface{}) { + if logger.level() >= FatalLevel { + entry := logger.newEntry() + entry.Fatal(args...) + logger.releaseEntry(entry) + } + Exit(1) +} + +func (logger *Logger) Panic(args ...interface{}) { + if logger.level() >= PanicLevel { + entry := logger.newEntry() + entry.Panic(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Debugln(args ...interface{}) { + if logger.level() >= DebugLevel { + entry := logger.newEntry() + entry.Debugln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Infoln(args ...interface{}) { + if logger.level() >= InfoLevel { + entry := logger.newEntry() + entry.Infoln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Println(args ...interface{}) { + entry := logger.newEntry() + entry.Println(args...) + logger.releaseEntry(entry) +} + +func (logger *Logger) Warnln(args ...interface{}) { + if logger.level() >= WarnLevel { + entry := logger.newEntry() + entry.Warnln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Warningln(args ...interface{}) { + if logger.level() >= WarnLevel { + entry := logger.newEntry() + entry.Warnln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Errorln(args ...interface{}) { + if logger.level() >= ErrorLevel { + entry := logger.newEntry() + entry.Errorln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Fatalln(args ...interface{}) { + if logger.level() >= FatalLevel { + entry := logger.newEntry() + entry.Fatalln(args...) + logger.releaseEntry(entry) + } + Exit(1) +} + +func (logger *Logger) Panicln(args ...interface{}) { + if logger.level() >= PanicLevel { + entry := logger.newEntry() + entry.Panicln(args...) + logger.releaseEntry(entry) + } +} + +//When file is opened with appending mode, it's safe to +//write concurrently to a file (within 4k message on Linux). +//In these cases user can choose to disable the lock. +func (logger *Logger) SetNoLock() { + logger.mu.Disable() +} + +func (logger *Logger) level() Level { + return Level(atomic.LoadUint32((*uint32)(&logger.Level))) +} + +func (logger *Logger) SetLevel(level Level) { + atomic.StoreUint32((*uint32)(&logger.Level), uint32(level)) +} + +func (logger *Logger) SetOutput(out io.Writer) { + logger.mu.Lock() + defer logger.mu.Unlock() + logger.Out = out +} + +func (logger *Logger) AddHook(hook Hook) { + logger.mu.Lock() + defer logger.mu.Unlock() + logger.Hooks.Add(hook) +} diff --git a/vendor/github.com/Sirupsen/logrus/logrus.go b/vendor/github.com/Sirupsen/logrus/logrus.go new file mode 100644 index 0000000000..dd38999741 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/logrus.go @@ -0,0 +1,143 @@ +package logrus + +import ( + "fmt" + "log" + "strings" +) + +// Fields type, used to pass to `WithFields`. +type Fields map[string]interface{} + +// Level type +type Level uint32 + +// Convert the Level to a string. E.g. PanicLevel becomes "panic". +func (level Level) String() string { + switch level { + case DebugLevel: + return "debug" + case InfoLevel: + return "info" + case WarnLevel: + return "warning" + case ErrorLevel: + return "error" + case FatalLevel: + return "fatal" + case PanicLevel: + return "panic" + } + + return "unknown" +} + +// ParseLevel takes a string level and returns the Logrus log level constant. +func ParseLevel(lvl string) (Level, error) { + switch strings.ToLower(lvl) { + case "panic": + return PanicLevel, nil + case "fatal": + return FatalLevel, nil + case "error": + return ErrorLevel, nil + case "warn", "warning": + return WarnLevel, nil + case "info": + return InfoLevel, nil + case "debug": + return DebugLevel, nil + } + + var l Level + return l, fmt.Errorf("not a valid logrus Level: %q", lvl) +} + +// A constant exposing all logging levels +var AllLevels = []Level{ + PanicLevel, + FatalLevel, + ErrorLevel, + WarnLevel, + InfoLevel, + DebugLevel, +} + +// These are the different logging levels. You can set the logging level to log +// on your instance of logger, obtained with `logrus.New()`. +const ( + // PanicLevel level, highest level of severity. Logs and then calls panic with the + // message passed to Debug, Info, ... + PanicLevel Level = iota + // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the + // logging level is set to Panic. + FatalLevel + // ErrorLevel level. Logs. Used for errors that should definitely be noted. + // Commonly used for hooks to send errors to an error tracking service. + ErrorLevel + // WarnLevel level. Non-critical entries that deserve eyes. + WarnLevel + // InfoLevel level. General operational entries about what's going on inside the + // application. + InfoLevel + // DebugLevel level. Usually only enabled when debugging. Very verbose logging. + DebugLevel +) + +// Won't compile if StdLogger can't be realized by a log.Logger +var ( + _ StdLogger = &log.Logger{} + _ StdLogger = &Entry{} + _ StdLogger = &Logger{} +) + +// StdLogger is what your logrus-enabled library should take, that way +// it'll accept a stdlib logger and a logrus logger. There's no standard +// interface, this is the closest we get, unfortunately. +type StdLogger interface { + Print(...interface{}) + Printf(string, ...interface{}) + Println(...interface{}) + + Fatal(...interface{}) + Fatalf(string, ...interface{}) + Fatalln(...interface{}) + + Panic(...interface{}) + Panicf(string, ...interface{}) + Panicln(...interface{}) +} + +// The FieldLogger interface generalizes the Entry and Logger types +type FieldLogger interface { + WithField(key string, value interface{}) *Entry + WithFields(fields Fields) *Entry + WithError(err error) *Entry + + Debugf(format string, args ...interface{}) + Infof(format string, args ...interface{}) + Printf(format string, args ...interface{}) + Warnf(format string, args ...interface{}) + Warningf(format string, args ...interface{}) + Errorf(format string, args ...interface{}) + Fatalf(format string, args ...interface{}) + Panicf(format string, args ...interface{}) + + Debug(args ...interface{}) + Info(args ...interface{}) + Print(args ...interface{}) + Warn(args ...interface{}) + Warning(args ...interface{}) + Error(args ...interface{}) + Fatal(args ...interface{}) + Panic(args ...interface{}) + + Debugln(args ...interface{}) + Infoln(args ...interface{}) + Println(args ...interface{}) + Warnln(args ...interface{}) + Warningln(args ...interface{}) + Errorln(args ...interface{}) + Fatalln(args ...interface{}) + Panicln(args ...interface{}) +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go new file mode 100644 index 0000000000..4880d13d26 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go @@ -0,0 +1,10 @@ +// +build darwin freebsd openbsd netbsd dragonfly +// +build !appengine,!gopherjs + +package logrus + +import "golang.org/x/sys/unix" + +const ioctlReadTermios = unix.TIOCGETA + +type Termios unix.Termios diff --git a/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go b/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go new file mode 100644 index 0000000000..3de08e802f --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go @@ -0,0 +1,11 @@ +// +build appengine gopherjs + +package logrus + +import ( + "io" +) + +func checkIfTerminal(w io.Writer) bool { + return true +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go new file mode 100644 index 0000000000..067047a123 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go @@ -0,0 +1,19 @@ +// +build !appengine,!gopherjs + +package logrus + +import ( + "io" + "os" + + "golang.org/x/crypto/ssh/terminal" +) + +func checkIfTerminal(w io.Writer) bool { + switch v := w.(type) { + case *os.File: + return terminal.IsTerminal(int(v.Fd())) + default: + return false + } +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_linux.go b/vendor/github.com/Sirupsen/logrus/terminal_linux.go new file mode 100644 index 0000000000..f29a0097c8 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/terminal_linux.go @@ -0,0 +1,14 @@ +// Based on ssh/terminal: +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !appengine,!gopherjs + +package logrus + +import "golang.org/x/sys/unix" + +const ioctlReadTermios = unix.TCGETS + +type Termios unix.Termios diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter.go b/vendor/github.com/Sirupsen/logrus/text_formatter.go new file mode 100644 index 0000000000..3e55040304 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/text_formatter.go @@ -0,0 +1,195 @@ +package logrus + +import ( + "bytes" + "fmt" + "sort" + "strings" + "sync" + "time" +) + +const ( + nocolor = 0 + red = 31 + green = 32 + yellow = 33 + blue = 36 + gray = 37 +) + +var ( + baseTimestamp time.Time + emptyFieldMap FieldMap +) + +func init() { + baseTimestamp = time.Now() +} + +// TextFormatter formats logs into text +type TextFormatter struct { + // Set to true to bypass checking for a TTY before outputting colors. + ForceColors bool + + // Force disabling colors. + DisableColors bool + + // Disable timestamp logging. useful when output is redirected to logging + // system that already adds timestamps. + DisableTimestamp bool + + // Enable logging the full timestamp when a TTY is attached instead of just + // the time passed since beginning of execution. + FullTimestamp bool + + // TimestampFormat to use for display when a full timestamp is printed + TimestampFormat string + + // The fields are sorted by default for a consistent output. For applications + // that log extremely frequently and don't use the JSON formatter this may not + // be desired. + DisableSorting bool + + // Disables the truncation of the level text to 4 characters. + DisableLevelTruncation bool + + // QuoteEmptyFields will wrap empty fields in quotes if true + QuoteEmptyFields bool + + // Whether the logger's out is to a terminal + isTerminal bool + + // FieldMap allows users to customize the names of keys for default fields. + // As an example: + // formatter := &TextFormatter{ + // FieldMap: FieldMap{ + // FieldKeyTime: "@timestamp", + // FieldKeyLevel: "@level", + // FieldKeyMsg: "@message"}} + FieldMap FieldMap + + sync.Once +} + +func (f *TextFormatter) init(entry *Entry) { + if entry.Logger != nil { + f.isTerminal = checkIfTerminal(entry.Logger.Out) + } +} + +// Format renders a single log entry +func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { + prefixFieldClashes(entry.Data, f.FieldMap) + + keys := make([]string, 0, len(entry.Data)) + for k := range entry.Data { + keys = append(keys, k) + } + + if !f.DisableSorting { + sort.Strings(keys) + } + + var b *bytes.Buffer + if entry.Buffer != nil { + b = entry.Buffer + } else { + b = &bytes.Buffer{} + } + + f.Do(func() { f.init(entry) }) + + isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors + + timestampFormat := f.TimestampFormat + if timestampFormat == "" { + timestampFormat = defaultTimestampFormat + } + if isColored { + f.printColored(b, entry, keys, timestampFormat) + } else { + if !f.DisableTimestamp { + f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyTime), entry.Time.Format(timestampFormat)) + } + f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyLevel), entry.Level.String()) + if entry.Message != "" { + f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyMsg), entry.Message) + } + for _, key := range keys { + f.appendKeyValue(b, key, entry.Data[key]) + } + } + + b.WriteByte('\n') + return b.Bytes(), nil +} + +func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { + var levelColor int + switch entry.Level { + case DebugLevel: + levelColor = gray + case WarnLevel: + levelColor = yellow + case ErrorLevel, FatalLevel, PanicLevel: + levelColor = red + default: + levelColor = blue + } + + levelText := strings.ToUpper(entry.Level.String()) + if !f.DisableLevelTruncation { + levelText = levelText[0:4] + } + + if f.DisableTimestamp { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message) + } else if !f.FullTimestamp { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message) + } else { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message) + } + for _, k := range keys { + v := entry.Data[k] + fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k) + f.appendValue(b, v) + } +} + +func (f *TextFormatter) needsQuoting(text string) bool { + if f.QuoteEmptyFields && len(text) == 0 { + return true + } + for _, ch := range text { + if !((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || + ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '@' || ch == '^' || ch == '+') { + return true + } + } + return false +} + +func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { + if b.Len() > 0 { + b.WriteByte(' ') + } + b.WriteString(key) + b.WriteByte('=') + f.appendValue(b, value) +} + +func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) { + stringVal, ok := value.(string) + if !ok { + stringVal = fmt.Sprint(value) + } + + if !f.needsQuoting(stringVal) { + b.WriteString(stringVal) + } else { + b.WriteString(fmt.Sprintf("%q", stringVal)) + } +} diff --git a/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/Sirupsen/logrus/writer.go new file mode 100644 index 0000000000..7bdebedc60 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/writer.go @@ -0,0 +1,62 @@ +package logrus + +import ( + "bufio" + "io" + "runtime" +) + +func (logger *Logger) Writer() *io.PipeWriter { + return logger.WriterLevel(InfoLevel) +} + +func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { + return NewEntry(logger).WriterLevel(level) +} + +func (entry *Entry) Writer() *io.PipeWriter { + return entry.WriterLevel(InfoLevel) +} + +func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { + reader, writer := io.Pipe() + + var printFunc func(args ...interface{}) + + switch level { + case DebugLevel: + printFunc = entry.Debug + case InfoLevel: + printFunc = entry.Info + case WarnLevel: + printFunc = entry.Warn + case ErrorLevel: + printFunc = entry.Error + case FatalLevel: + printFunc = entry.Fatal + case PanicLevel: + printFunc = entry.Panic + default: + printFunc = entry.Print + } + + go entry.writerScanner(reader, printFunc) + runtime.SetFinalizer(writer, writerFinalizer) + + return writer +} + +func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + printFunc(scanner.Text()) + } + if err := scanner.Err(); err != nil { + entry.Errorf("Error while reading from Writer: %s", err) + } + reader.Close() +} + +func writerFinalizer(writer *io.PipeWriter) { + writer.Close() +} diff --git a/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go b/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go deleted file mode 100644 index 16686a6552..0000000000 --- a/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/empty/empty.proto - -package empty - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/empty.proto. - -type Empty = emptypb.Empty - -var File_github_com_golang_protobuf_ptypes_empty_empty_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = []byte{ - 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x3b, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() } -func file_github_com_golang_protobuf_ptypes_empty_empty_proto_init() { - if File_github_com_golang_protobuf_ptypes_empty_empty_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_empty_empty_proto = out.File - file_github_com_golang_protobuf_ptypes_empty_empty_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_empty_empty_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_empty_empty_proto_depIdxs = nil -} diff --git a/vendor/github.com/gorilla/handlers/.editorconfig b/vendor/github.com/gorilla/handlers/.editorconfig new file mode 100644 index 0000000000..c6b74c3e0d --- /dev/null +++ b/vendor/github.com/gorilla/handlers/.editorconfig @@ -0,0 +1,20 @@ +; https://editorconfig.org/ + +root = true + +[*] +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[{Makefile,go.mod,go.sum,*.go,.gitmodules}] +indent_style = tab +indent_size = 4 + +[*.md] +indent_size = 4 +trim_trailing_whitespace = false + +eclint_indent_style = unset \ No newline at end of file diff --git a/vendor/github.com/gorilla/handlers/.gitignore b/vendor/github.com/gorilla/handlers/.gitignore new file mode 100644 index 0000000000..577a89e813 --- /dev/null +++ b/vendor/github.com/gorilla/handlers/.gitignore @@ -0,0 +1,2 @@ +# Output of the go test coverage tool +coverage.coverprofile diff --git a/vendor/github.com/gorilla/handlers/LICENSE b/vendor/github.com/gorilla/handlers/LICENSE index 66ea3c8ae7..bb9d80bc9b 100644 --- a/vendor/github.com/gorilla/handlers/LICENSE +++ b/vendor/github.com/gorilla/handlers/LICENSE @@ -1,22 +1,27 @@ -Copyright (c) 2013 The Gorilla Handlers Authors. All rights reserved. +Copyright (c) 2023 The Gorilla Authors. All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +modification, are permitted provided that the following conditions are +met: - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gorilla/handlers/Makefile b/vendor/github.com/gorilla/handlers/Makefile new file mode 100644 index 0000000000..003b784f7e --- /dev/null +++ b/vendor/github.com/gorilla/handlers/Makefile @@ -0,0 +1,34 @@ +GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '') +GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest + +GO_SEC=$(shell which gosec 2> /dev/null || echo '') +GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest + +GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '') +GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest + +.PHONY: verify +verify: sec govulncheck lint test + +.PHONY: lint +lint: + $(if $(GO_LINT), ,go install $(GO_LINT_URI)) + @echo "##### Running golangci-lint #####" + golangci-lint run -v + +.PHONY: sec +sec: + $(if $(GO_SEC), ,go install $(GO_SEC_URI)) + @echo "##### Running gosec #####" + gosec ./... + +.PHONY: govulncheck +govulncheck: + $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI)) + @echo "##### Running govulncheck #####" + govulncheck ./... + +.PHONY: test +test: + @echo "##### Running tests #####" + go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./... diff --git a/vendor/github.com/gorilla/handlers/README.md b/vendor/github.com/gorilla/handlers/README.md index 6eba66bf30..02555b2642 100644 --- a/vendor/github.com/gorilla/handlers/README.md +++ b/vendor/github.com/gorilla/handlers/README.md @@ -1,10 +1,10 @@ -gorilla/handlers -================ +# gorilla/handlers + +![Testing](https://github.com/gorilla/handlers/actions/workflows/test.yml/badge.svg) +[![Codecov](https://codecov.io/github/gorilla/handlers/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/handlers) [![GoDoc](https://godoc.org/github.com/gorilla/handlers?status.svg)](https://godoc.org/github.com/gorilla/handlers) -[![CircleCI](https://circleci.com/gh/gorilla/handlers.svg?style=svg)](https://circleci.com/gh/gorilla/handlers) [![Sourcegraph](https://sourcegraph.com/github.com/gorilla/handlers/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/handlers?badge) - Package handlers is a collection of handlers (aka "HTTP middleware") for use with Go's `net/http` package (or any framework supporting `http.Handler`), including: diff --git a/vendor/github.com/gorilla/handlers/canonical.go b/vendor/github.com/gorilla/handlers/canonical.go index 8437fefc1e..7121f5307b 100644 --- a/vendor/github.com/gorilla/handlers/canonical.go +++ b/vendor/github.com/gorilla/handlers/canonical.go @@ -21,12 +21,11 @@ type canonical struct { // // Example: // -// r := mux.NewRouter() -// canonical := handlers.CanonicalHost("http://www.gorillatoolkit.org", 302) -// r.HandleFunc("/route", YourHandler) -// -// log.Fatal(http.ListenAndServe(":7000", canonical(r))) +// r := mux.NewRouter() +// canonical := handlers.CanonicalHost("http://www.gorillatoolkit.org", 302) +// r.HandleFunc("/route", YourHandler) // +// log.Fatal(http.ListenAndServe(":7000", canonical(r))) func CanonicalHost(domain string, code int) func(h http.Handler) http.Handler { fn := func(h http.Handler) http.Handler { return canonical{h, domain, code} diff --git a/vendor/github.com/gorilla/handlers/compress.go b/vendor/github.com/gorilla/handlers/compress.go index 1e95f1ccbf..d6f589503b 100644 --- a/vendor/github.com/gorilla/handlers/compress.go +++ b/vendor/github.com/gorilla/handlers/compress.go @@ -44,13 +44,13 @@ type flusher interface { Flush() error } -func (w *compressResponseWriter) Flush() { +func (cw *compressResponseWriter) Flush() { // Flush compressed data if compressor supports it. - if f, ok := w.compressor.(flusher); ok { - f.Flush() + if f, ok := cw.compressor.(flusher); ok { + _ = f.Flush() } // Flush HTTP response. - if f, ok := w.w.(http.Flusher); ok { + if f, ok := cw.w.(http.Flusher); ok { f.Flush() } } diff --git a/vendor/github.com/gorilla/handlers/cors.go b/vendor/github.com/gorilla/handlers/cors.go index 0dcdffb3d3..8af9c096e5 100644 --- a/vendor/github.com/gorilla/handlers/cors.go +++ b/vendor/github.com/gorilla/handlers/cors.go @@ -26,14 +26,14 @@ type cors struct { type OriginValidator func(string) bool var ( - defaultCorsOptionStatusCode = 200 - defaultCorsMethods = []string{"GET", "HEAD", "POST"} + defaultCorsOptionStatusCode = http.StatusOK + defaultCorsMethods = []string{http.MethodGet, http.MethodHead, http.MethodPost} defaultCorsHeaders = []string{"Accept", "Accept-Language", "Content-Language", "Origin"} - // (WebKit/Safari v9 sends the Origin header by default in AJAX requests) + // (WebKit/Safari v9 sends the Origin header by default in AJAX requests). ) const ( - corsOptionMethod string = "OPTIONS" + corsOptionMethod string = http.MethodOptions corsAllowOriginHeader string = "Access-Control-Allow-Origin" corsExposeHeadersHeader string = "Access-Control-Expose-Headers" corsMaxAgeHeader string = "Access-Control-Max-Age" @@ -101,10 +101,8 @@ func (ch *cors) ServeHTTP(w http.ResponseWriter, r *http.Request) { if !ch.isMatch(method, defaultCorsMethods) { w.Header().Set(corsAllowMethodsHeader, method) } - } else { - if len(ch.exposedHeaders) > 0 { - w.Header().Set(corsExposeHeadersHeader, strings.Join(ch.exposedHeaders, ",")) - } + } else if len(ch.exposedHeaders) > 0 { + w.Header().Set(corsExposeHeadersHeader, strings.Join(ch.exposedHeaders, ",")) } if ch.allowCredentials { @@ -141,22 +139,21 @@ func (ch *cors) ServeHTTP(w http.ResponseWriter, r *http.Request) { // CORS provides Cross-Origin Resource Sharing middleware. // Example: // -// import ( -// "net/http" -// -// "github.com/gorilla/handlers" -// "github.com/gorilla/mux" -// ) +// import ( +// "net/http" // -// func main() { -// r := mux.NewRouter() -// r.HandleFunc("/users", UserEndpoint) -// r.HandleFunc("/projects", ProjectEndpoint) +// "github.com/gorilla/handlers" +// "github.com/gorilla/mux" +// ) // -// // Apply the CORS middleware to our top-level router, with the defaults. -// http.ListenAndServe(":8000", handlers.CORS()(r)) -// } +// func main() { +// r := mux.NewRouter() +// r.HandleFunc("/users", UserEndpoint) +// r.HandleFunc("/projects", ProjectEndpoint) // +// // Apply the CORS middleware to our top-level router, with the defaults. +// http.ListenAndServe(":8000", handlers.CORS()(r)) +// } func CORS(opts ...CORSOption) func(http.Handler) http.Handler { return func(h http.Handler) http.Handler { ch := parseCORSOptions(opts...) @@ -174,7 +171,7 @@ func parseCORSOptions(opts ...CORSOption) *cors { } for _, option := range opts { - option(ch) + _ = option(ch) //TODO: @bharat-rajani, return error to caller if not nil? } return ch diff --git a/vendor/github.com/gorilla/handlers/handlers.go b/vendor/github.com/gorilla/handlers/handlers.go index 0509482ad7..9b92fce333 100644 --- a/vendor/github.com/gorilla/handlers/handlers.go +++ b/vendor/github.com/gorilla/handlers/handlers.go @@ -35,7 +35,7 @@ func (h MethodHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } sort.Strings(allow) w.Header().Set("Allow", strings.Join(allow, ", ")) - if req.Method == "OPTIONS" { + if req.Method == http.MethodOptions { w.WriteHeader(http.StatusOK) } else { http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) @@ -44,7 +44,7 @@ func (h MethodHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } // responseLogger is wrapper of http.ResponseWriter that keeps track of its HTTP -// status code and body size +// status code and body size. type responseLogger struct { w http.ResponseWriter status int @@ -97,7 +97,7 @@ func isContentType(h http.Header, contentType string) bool { // Only PUT, POST, and PATCH requests are considered. func ContentTypeHandler(h http.Handler, contentTypes ...string) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if !(r.Method == "PUT" || r.Method == "POST" || r.Method == "PATCH") { + if !(r.Method == http.MethodPut || r.Method == http.MethodPost || r.Method == http.MethodPatch) { h.ServeHTTP(w, r) return } @@ -108,7 +108,10 @@ func ContentTypeHandler(h http.Handler, contentTypes ...string) http.Handler { return } } - http.Error(w, fmt.Sprintf("Unsupported content type %q; expected one of %q", r.Header.Get("Content-Type"), contentTypes), http.StatusUnsupportedMediaType) + http.Error(w, fmt.Sprintf("Unsupported content type %q; expected one of %q", + r.Header.Get("Content-Type"), + contentTypes), + http.StatusUnsupportedMediaType) }) } @@ -133,12 +136,12 @@ const ( // Form method takes precedence over header method. func HTTPMethodOverrideHandler(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Method == "POST" { + if r.Method == http.MethodPost { om := r.FormValue(HTTPMethodOverrideFormKey) if om == "" { om = r.Header.Get(HTTPMethodOverrideHeader) } - if om == "PUT" || om == "PATCH" || om == "DELETE" { + if om == http.MethodPut || om == http.MethodPatch || om == http.MethodDelete { r.Method = om } } diff --git a/vendor/github.com/gorilla/handlers/logging.go b/vendor/github.com/gorilla/handlers/logging.go index 228465eba0..2badb6fbff 100644 --- a/vendor/github.com/gorilla/handlers/logging.go +++ b/vendor/github.com/gorilla/handlers/logging.go @@ -18,7 +18,7 @@ import ( // Logging -// LogFormatterParams is the structure any formatter will be handed when time to log comes +// LogFormatterParams is the structure any formatter will be handed when time to log comes. type LogFormatterParams struct { Request *http.Request URL url.URL @@ -27,7 +27,7 @@ type LogFormatterParams struct { Size int } -// LogFormatter gives the signature of the formatter function passed to CustomLoggingHandler +// LogFormatter gives the signature of the formatter function passed to CustomLoggingHandler. type LogFormatter func(writer io.Writer, params LogFormatterParams) // loggingHandler is the http.Handler implementation for LoggingHandlerTo and its @@ -46,7 +46,10 @@ func (h loggingHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { h.handler.ServeHTTP(w, req) if req.MultipartForm != nil { - req.MultipartForm.RemoveAll() + err := req.MultipartForm.RemoveAll() + if err != nil { + return + } } params := LogFormatterParams{ @@ -76,7 +79,7 @@ const lowerhex = "0123456789abcdef" func appendQuoted(buf []byte, s string) []byte { var runeTmp [utf8.UTFMax]byte - for width := 0; len(s) > 0; s = s[width:] { + for width := 0; len(s) > 0; s = s[width:] { //nolint: wastedassign //TODO: why width starts from 0and reassigned as 1 r := rune(s[0]) width = 1 if r >= utf8.RuneSelf { @@ -191,7 +194,7 @@ func buildCommonLogLine(req *http.Request, url url.URL, ts time.Time, status int func writeLog(writer io.Writer, params LogFormatterParams) { buf := buildCommonLogLine(params.Request, params.URL, params.TimeStamp, params.StatusCode, params.Size) buf = append(buf, '\n') - writer.Write(buf) + _, _ = writer.Write(buf) } // writeCombinedLog writes a log entry for req to w in Apache Combined Log Format. @@ -204,7 +207,7 @@ func writeCombinedLog(writer io.Writer, params LogFormatterParams) { buf = append(buf, `" "`...) buf = appendQuoted(buf, params.Request.UserAgent()) buf = append(buf, '"', '\n') - writer.Write(buf) + _, _ = writer.Write(buf) } // CombinedLoggingHandler return a http.Handler that wraps h and logs requests to out in @@ -212,7 +215,7 @@ func writeCombinedLog(writer io.Writer, params LogFormatterParams) { // // See http://httpd.apache.org/docs/2.2/logs.html#combined for a description of this format. // -// LoggingHandler always sets the ident field of the log to - +// LoggingHandler always sets the ident field of the log to -. func CombinedLoggingHandler(out io.Writer, h http.Handler) http.Handler { return loggingHandler{out, h, writeCombinedLog} } @@ -226,19 +229,18 @@ func CombinedLoggingHandler(out io.Writer, h http.Handler) http.Handler { // // Example: // -// r := mux.NewRouter() -// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { -// w.Write([]byte("This is a catch-all route")) -// }) -// loggedRouter := handlers.LoggingHandler(os.Stdout, r) -// http.ListenAndServe(":1123", loggedRouter) -// +// r := mux.NewRouter() +// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { +// w.Write([]byte("This is a catch-all route")) +// }) +// loggedRouter := handlers.LoggingHandler(os.Stdout, r) +// http.ListenAndServe(":1123", loggedRouter) func LoggingHandler(out io.Writer, h http.Handler) http.Handler { return loggingHandler{out, h, writeLog} } // CustomLoggingHandler provides a way to supply a custom log formatter -// while taking advantage of the mechanisms in this package +// while taking advantage of the mechanisms in this package. func CustomLoggingHandler(out io.Writer, h http.Handler, f LogFormatter) http.Handler { return loggingHandler{out, h, f} } diff --git a/vendor/github.com/gorilla/handlers/proxy_headers.go b/vendor/github.com/gorilla/handlers/proxy_headers.go index ed939dcef5..281d753e95 100644 --- a/vendor/github.com/gorilla/handlers/proxy_headers.go +++ b/vendor/github.com/gorilla/handlers/proxy_headers.go @@ -18,7 +18,7 @@ var ( var ( // RFC7239 defines a new "Forwarded: " header designed to replace the // existing use of X-Forwarded-* headers. - // e.g. Forwarded: for=192.0.2.60;proto=https;by=203.0.113.43 + // e.g. Forwarded: for=192.0.2.60;proto=https;by=203.0.113.43. forwarded = http.CanonicalHeaderKey("Forwarded") // Allows for a sub-match of the first value after 'for=' to the next // comma, semi-colon or space. The match is case-insensitive. @@ -67,7 +67,9 @@ func ProxyHeaders(h http.Handler) http.Handler { func getIP(r *http.Request) string { var addr string - if fwd := r.Header.Get(xForwardedFor); fwd != "" { + switch { + case r.Header.Get(xForwardedFor) != "": + fwd := r.Header.Get(xForwardedFor) // Only grab the first (client) address. Note that '192.168.0.1, // 10.1.1.1' is a valid key for X-Forwarded-For where addresses after // the first may represent forwarding proxies earlier in the chain. @@ -76,17 +78,15 @@ func getIP(r *http.Request) string { s = len(fwd) } addr = fwd[:s] - } else if fwd := r.Header.Get(xRealIP); fwd != "" { - // X-Real-IP should only contain one IP address (the client making the - // request). - addr = fwd - } else if fwd := r.Header.Get(forwarded); fwd != "" { + case r.Header.Get(xRealIP) != "": + addr = r.Header.Get(xRealIP) + case r.Header.Get(forwarded) != "": // match should contain at least two elements if the protocol was // specified in the Forwarded header. The first element will always be // the 'for=' capture, which we ignore. In the case of multiple IP // addresses (for=8.8.8.8, 8.8.4.4,172.16.1.20 is valid) we only // extract the first, which should be the client IP. - if match := forRegex.FindStringSubmatch(fwd); len(match) > 1 { + if match := forRegex.FindStringSubmatch(r.Header.Get(forwarded)); len(match) > 1 { // IPv6 addresses in Forwarded headers are quoted-strings. We strip // these quotes. addr = strings.Trim(match[1], `"`) diff --git a/vendor/github.com/gorilla/handlers/recovery.go b/vendor/github.com/gorilla/handlers/recovery.go index 4c4c1d9c6c..0d4f955ecb 100644 --- a/vendor/github.com/gorilla/handlers/recovery.go +++ b/vendor/github.com/gorilla/handlers/recovery.go @@ -36,12 +36,12 @@ func parseRecoveryOptions(h http.Handler, opts ...RecoveryOption) http.Handler { // // Example: // -// r := mux.NewRouter() -// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { -// panic("Unexpected error!") -// }) +// r := mux.NewRouter() +// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { +// panic("Unexpected error!") +// }) // -// http.ListenAndServe(":1123", handlers.RecoveryHandler()(r)) +// http.ListenAndServe(":1123", handlers.RecoveryHandler()(r)) func RecoveryHandler(opts ...RecoveryOption) func(h http.Handler) http.Handler { return func(h http.Handler) http.Handler { r := &recoveryHandler{handler: h} @@ -50,20 +50,22 @@ func RecoveryHandler(opts ...RecoveryOption) func(h http.Handler) http.Handler { } // RecoveryLogger is a functional option to override -// the default logger +// the default logger. func RecoveryLogger(logger RecoveryHandlerLogger) RecoveryOption { return func(h http.Handler) { - r := h.(*recoveryHandler) + r := h.(*recoveryHandler) //nolint:errcheck //TODO: + // @bharat-rajani should return type-assertion error but would break the API? r.logger = logger } } // PrintRecoveryStack is a functional option to enable // or disable printing stack traces on panic. -func PrintRecoveryStack(print bool) RecoveryOption { +func PrintRecoveryStack(shouldPrint bool) RecoveryOption { return func(h http.Handler) { - r := h.(*recoveryHandler) - r.printStack = print + r := h.(*recoveryHandler) //nolint:errcheck //TODO: + // @bharat-rajani should return type-assertion error but would break the API? + r.printStack = shouldPrint } } diff --git a/vendor/github.com/gorilla/mux/.editorconfig b/vendor/github.com/gorilla/mux/.editorconfig new file mode 100644 index 0000000000..c6b74c3e0d --- /dev/null +++ b/vendor/github.com/gorilla/mux/.editorconfig @@ -0,0 +1,20 @@ +; https://editorconfig.org/ + +root = true + +[*] +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[{Makefile,go.mod,go.sum,*.go,.gitmodules}] +indent_style = tab +indent_size = 4 + +[*.md] +indent_size = 4 +trim_trailing_whitespace = false + +eclint_indent_style = unset \ No newline at end of file diff --git a/vendor/github.com/gorilla/mux/.gitignore b/vendor/github.com/gorilla/mux/.gitignore new file mode 100644 index 0000000000..84039fec68 --- /dev/null +++ b/vendor/github.com/gorilla/mux/.gitignore @@ -0,0 +1 @@ +coverage.coverprofile diff --git a/vendor/github.com/gorilla/mux/AUTHORS b/vendor/github.com/gorilla/mux/AUTHORS deleted file mode 100644 index b722392ee5..0000000000 --- a/vendor/github.com/gorilla/mux/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -# This is the official list of gorilla/mux authors for copyright purposes. -# -# Please keep the list sorted. - -Google LLC (https://opensource.google.com/) -Kamil Kisielk -Matt Silverlock -Rodrigo Moraes (https://github.com/moraes) diff --git a/vendor/github.com/gorilla/mux/LICENSE b/vendor/github.com/gorilla/mux/LICENSE index 6903df6386..bb9d80bc9b 100644 --- a/vendor/github.com/gorilla/mux/LICENSE +++ b/vendor/github.com/gorilla/mux/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved. +Copyright (c) 2023 The Gorilla Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/vendor/github.com/gorilla/mux/Makefile b/vendor/github.com/gorilla/mux/Makefile new file mode 100644 index 0000000000..98f5ab75f9 --- /dev/null +++ b/vendor/github.com/gorilla/mux/Makefile @@ -0,0 +1,34 @@ +GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '') +GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest + +GO_SEC=$(shell which gosec 2> /dev/null || echo '') +GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest + +GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '') +GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest + +.PHONY: golangci-lint +golangci-lint: + $(if $(GO_LINT), ,go install $(GO_LINT_URI)) + @echo "##### Running golangci-lint" + golangci-lint run -v + +.PHONY: gosec +gosec: + $(if $(GO_SEC), ,go install $(GO_SEC_URI)) + @echo "##### Running gosec" + gosec ./... + +.PHONY: govulncheck +govulncheck: + $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI)) + @echo "##### Running govulncheck" + govulncheck ./... + +.PHONY: verify +verify: golangci-lint gosec govulncheck + +.PHONY: test +test: + @echo "##### Running tests" + go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./... \ No newline at end of file diff --git a/vendor/github.com/gorilla/mux/README.md b/vendor/github.com/gorilla/mux/README.md index 35eea9f106..382513d57c 100644 --- a/vendor/github.com/gorilla/mux/README.md +++ b/vendor/github.com/gorilla/mux/README.md @@ -1,12 +1,12 @@ # gorilla/mux -[![GoDoc](https://godoc.org/github.com/gorilla/mux?status.svg)](https://godoc.org/github.com/gorilla/mux) -[![CircleCI](https://circleci.com/gh/gorilla/mux.svg?style=svg)](https://circleci.com/gh/gorilla/mux) -[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/mux/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/mux?badge) +![testing](https://github.com/gorilla/mux/actions/workflows/test.yml/badge.svg) +[![codecov](https://codecov.io/github/gorilla/mux/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/mux) +[![godoc](https://godoc.org/github.com/gorilla/mux?status.svg)](https://godoc.org/github.com/gorilla/mux) +[![sourcegraph](https://sourcegraph.com/github.com/gorilla/mux/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/mux?badge) -![Gorilla Logo](https://cloud-cdn.questionable.services/gorilla-icon-64.png) -https://www.gorillatoolkit.org/pkg/mux +![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5) Package `gorilla/mux` implements a request router and dispatcher for matching incoming requests to their respective handler. @@ -247,32 +247,25 @@ type spaHandler struct { // file located at the index path on the SPA handler will be served. This // is suitable behavior for serving an SPA (single page application). func (h spaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - // get the absolute path to prevent directory traversal - path, err := filepath.Abs(r.URL.Path) - if err != nil { - // if we failed to get the absolute path respond with a 400 bad request - // and stop - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - // prepend the path with the path to the static directory - path = filepath.Join(h.staticPath, path) + // Join internally call path.Clean to prevent directory traversal + path := filepath.Join(h.staticPath, r.URL.Path) - // check whether a file exists at the given path - _, err = os.Stat(path) - if os.IsNotExist(err) { - // file does not exist, serve index.html + // check whether a file exists or is a directory at the given path + fi, err := os.Stat(path) + if os.IsNotExist(err) || fi.IsDir() { + // file does not exist or path is a directory, serve index.html http.ServeFile(w, r, filepath.Join(h.staticPath, h.indexPath)) return - } else if err != nil { - // if we got an error (that wasn't that the file doesn't exist) stating the - // file, return a 500 internal server error and stop + } + + if err != nil { + // if we got an error (that wasn't that the file doesn't exist) stating the + // file, return a 500 internal server error and stop http.Error(w, err.Error(), http.StatusInternalServerError) - return + return } - // otherwise, use http.FileServer to serve the static dir + // otherwise, use http.FileServer to serve the static file http.FileServer(http.Dir(h.staticPath)).ServeHTTP(w, r) } @@ -375,6 +368,19 @@ url, err := r.Get("article").URL("subdomain", "news", "id", "42") ``` +To find all the required variables for a given route when calling `URL()`, the method `GetVarNames()` is available: +```go +r := mux.NewRouter() +r.Host("{domain}"). + Path("/{group}/{item_id}"). + Queries("some_data1", "{some_data1}"). + Queries("some_data2", "{some_data2}"). + Name("article") + +// Will print [domain group item_id some_data1 some_data2] +fmt.Println(r.Get("article").GetVarNames()) + +``` ### Walking Routes The `Walk` function on `mux.Router` can be used to visit all of the routes that are registered on a router. For example, @@ -572,7 +578,7 @@ func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler r := mux.NewRouter() r.HandleFunc("/", handler) -amw := authenticationMiddleware{} +amw := authenticationMiddleware{tokenUsers: make(map[string]string)} amw.Populate() r.Use(amw.Middleware) @@ -758,7 +764,8 @@ func TestMetricsHandler(t *testing.T) { rr := httptest.NewRecorder() - // Need to create a router that we can pass the request through so that the vars will be added to the context + // To add the vars to the context, + // we need to create a router through which we can pass the request. router := mux.NewRouter() router.HandleFunc("/metrics/{type}", MetricsHandler) router.ServeHTTP(rr, req) diff --git a/vendor/github.com/gorilla/mux/doc.go b/vendor/github.com/gorilla/mux/doc.go index bd5a38b55d..80601351fd 100644 --- a/vendor/github.com/gorilla/mux/doc.go +++ b/vendor/github.com/gorilla/mux/doc.go @@ -10,18 +10,18 @@ http.ServeMux, mux.Router matches incoming requests against a list of registered routes and calls a handler for the route that matches the URL or other conditions. The main features are: - * Requests can be matched based on URL host, path, path prefix, schemes, - header and query values, HTTP methods or using custom matchers. - * URL hosts, paths and query values can have variables with an optional - regular expression. - * Registered URLs can be built, or "reversed", which helps maintaining - references to resources. - * Routes can be used as subrouters: nested routes are only tested if the - parent route matches. This is useful to define groups of routes that - share common conditions like a host, a path prefix or other repeated - attributes. As a bonus, this optimizes request matching. - * It implements the http.Handler interface so it is compatible with the - standard http.ServeMux. + - Requests can be matched based on URL host, path, path prefix, schemes, + header and query values, HTTP methods or using custom matchers. + - URL hosts, paths and query values can have variables with an optional + regular expression. + - Registered URLs can be built, or "reversed", which helps maintaining + references to resources. + - Routes can be used as subrouters: nested routes are only tested if the + parent route matches. This is useful to define groups of routes that + share common conditions like a host, a path prefix or other repeated + attributes. As a bonus, this optimizes request matching. + - It implements the http.Handler interface so it is compatible with the + standard http.ServeMux. Let's start registering a couple of URL paths and handlers: @@ -301,6 +301,5 @@ A more complex authentication middleware, which maps session token to users, cou r.Use(amw.Middleware) Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. - */ package mux diff --git a/vendor/github.com/gorilla/mux/mux.go b/vendor/github.com/gorilla/mux/mux.go index 782a34b22a..1e089906fa 100644 --- a/vendor/github.com/gorilla/mux/mux.go +++ b/vendor/github.com/gorilla/mux/mux.go @@ -31,24 +31,26 @@ func NewRouter() *Router { // It implements the http.Handler interface, so it can be registered to serve // requests: // -// var router = mux.NewRouter() +// var router = mux.NewRouter() // -// func main() { -// http.Handle("/", router) -// } +// func main() { +// http.Handle("/", router) +// } // // Or, for Google App Engine, register it in a init() function: // -// func init() { -// http.Handle("/", router) -// } +// func init() { +// http.Handle("/", router) +// } // // This will send all incoming requests to the router. type Router struct { // Configurable Handler to be used when no route matches. + // This can be used to render your own 404 Not Found errors. NotFoundHandler http.Handler // Configurable Handler to be used when the request method does not match the route. + // This can be used to render your own 405 Method Not Allowed errors. MethodNotAllowedHandler http.Handler // Routes to be matched, in order. diff --git a/vendor/github.com/gorilla/mux/regexp.go b/vendor/github.com/gorilla/mux/regexp.go index 0144842bb2..5d05cfa0e9 100644 --- a/vendor/github.com/gorilla/mux/regexp.go +++ b/vendor/github.com/gorilla/mux/regexp.go @@ -22,10 +22,10 @@ type routeRegexpOptions struct { type regexpType int const ( - regexpTypePath regexpType = 0 - regexpTypeHost regexpType = 1 - regexpTypePrefix regexpType = 2 - regexpTypeQuery regexpType = 3 + regexpTypePath regexpType = iota + regexpTypeHost + regexpTypePrefix + regexpTypeQuery ) // newRouteRegexp parses a route template and returns a routeRegexp, @@ -195,7 +195,7 @@ func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool { // url builds a URL part using the given values. func (r *routeRegexp) url(values map[string]string) (string, error) { - urlValues := make([]interface{}, len(r.varsN), len(r.varsN)) + urlValues := make([]interface{}, len(r.varsN)) for k, v := range r.varsN { value, ok := values[v] if !ok { diff --git a/vendor/github.com/gorilla/mux/route.go b/vendor/github.com/gorilla/mux/route.go index 750afe570d..e8f11df221 100644 --- a/vendor/github.com/gorilla/mux/route.go +++ b/vendor/github.com/gorilla/mux/route.go @@ -64,8 +64,18 @@ func (r *Route) Match(req *http.Request, match *RouteMatch) bool { match.MatchErr = nil } - matchErr = nil + matchErr = nil // nolint:ineffassign return false + } else { + // Multiple routes may share the same path but use different HTTP methods. For instance: + // Route 1: POST "/users/{id}". + // Route 2: GET "/users/{id}", parameters: "id": "[0-9]+". + // + // The router must handle these cases correctly. For a GET request to "/users/abc" with "id" as "-2", + // The router should return a "Not Found" error as no route fully matches this request. + if match.MatchErr == ErrMethodMismatch { + match.MatchErr = nil + } } } @@ -230,9 +240,9 @@ func (m headerMatcher) Match(r *http.Request, match *RouteMatch) bool { // Headers adds a matcher for request header values. // It accepts a sequence of key/value pairs to be matched. For example: // -// r := mux.NewRouter() -// r.Headers("Content-Type", "application/json", -// "X-Requested-With", "XMLHttpRequest") +// r := mux.NewRouter().NewRoute() +// r.Headers("Content-Type", "application/json", +// "X-Requested-With", "XMLHttpRequest") // // The above route will only match if both request header values match. // If the value is an empty string, it will match any value if the key is set. @@ -255,9 +265,9 @@ func (m headerRegexMatcher) Match(r *http.Request, match *RouteMatch) bool { // HeadersRegexp accepts a sequence of key/value pairs, where the value has regex // support. For example: // -// r := mux.NewRouter() -// r.HeadersRegexp("Content-Type", "application/(text|json)", -// "X-Requested-With", "XMLHttpRequest") +// r := mux.NewRouter().NewRoute() +// r.HeadersRegexp("Content-Type", "application/(text|json)", +// "X-Requested-With", "XMLHttpRequest") // // The above route will only match if both the request header matches both regular expressions. // If the value is an empty string, it will match any value if the key is set. @@ -283,10 +293,10 @@ func (r *Route) HeadersRegexp(pairs ...string) *Route { // // For example: // -// r := mux.NewRouter() -// r.Host("www.example.com") -// r.Host("{subdomain}.domain.com") -// r.Host("{subdomain:[a-z]+}.domain.com") +// r := mux.NewRouter().NewRoute() +// r.Host("www.example.com") +// r.Host("{subdomain}.domain.com") +// r.Host("{subdomain:[a-z]+}.domain.com") // // Variable names must be unique in a given route. They can be retrieved // calling mux.Vars(request). @@ -342,11 +352,11 @@ func (r *Route) Methods(methods ...string) *Route { // // For example: // -// r := mux.NewRouter() -// r.Path("/products/").Handler(ProductsHandler) -// r.Path("/products/{key}").Handler(ProductsHandler) -// r.Path("/articles/{category}/{id:[0-9]+}"). -// Handler(ArticleHandler) +// r := mux.NewRouter().NewRoute() +// r.Path("/products/").Handler(ProductsHandler) +// r.Path("/products/{key}").Handler(ProductsHandler) +// r.Path("/articles/{category}/{id:[0-9]+}"). +// Handler(ArticleHandler) // // Variable names must be unique in a given route. They can be retrieved // calling mux.Vars(request). @@ -377,8 +387,8 @@ func (r *Route) PathPrefix(tpl string) *Route { // It accepts a sequence of key/value pairs. Values may define variables. // For example: // -// r := mux.NewRouter() -// r.Queries("foo", "bar", "id", "{id:[0-9]+}") +// r := mux.NewRouter().NewRoute() +// r.Queries("foo", "bar", "id", "{id:[0-9]+}") // // The above route will only match if the URL contains the defined queries // values, e.g.: ?foo=bar&id=42. @@ -473,11 +483,11 @@ func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route { // // It will test the inner routes only if the parent route matched. For example: // -// r := mux.NewRouter() -// s := r.Host("www.example.com").Subrouter() -// s.HandleFunc("/products/", ProductsHandler) -// s.HandleFunc("/products/{key}", ProductHandler) -// s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler) +// r := mux.NewRouter().NewRoute() +// s := r.Host("www.example.com").Subrouter() +// s.HandleFunc("/products/", ProductsHandler) +// s.HandleFunc("/products/{key}", ProductHandler) +// s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler) // // Here, the routes registered in the subrouter won't be tested if the host // doesn't match. @@ -497,36 +507,36 @@ func (r *Route) Subrouter() *Router { // It accepts a sequence of key/value pairs for the route variables. For // example, given this route: // -// r := mux.NewRouter() -// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). -// Name("article") +// r := mux.NewRouter() +// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). +// Name("article") // // ...a URL for it can be built using: // -// url, err := r.Get("article").URL("category", "technology", "id", "42") +// url, err := r.Get("article").URL("category", "technology", "id", "42") // // ...which will return an url.URL with the following path: // -// "/articles/technology/42" +// "/articles/technology/42" // // This also works for host variables: // -// r := mux.NewRouter() -// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). -// Host("{subdomain}.domain.com"). -// Name("article") +// r := mux.NewRouter() +// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). +// Host("{subdomain}.domain.com"). +// Name("article") // -// // url.String() will be "http://news.domain.com/articles/technology/42" -// url, err := r.Get("article").URL("subdomain", "news", -// "category", "technology", -// "id", "42") +// // url.String() will be "http://news.domain.com/articles/technology/42" +// url, err := r.Get("article").URL("subdomain", "news", +// "category", "technology", +// "id", "42") // // The scheme of the resulting url will be the first argument that was passed to Schemes: // -// // url.String() will be "https://example.com" -// r := mux.NewRouter() -// url, err := r.Host("example.com") -// .Schemes("https", "http").URL() +// // url.String() will be "https://example.com" +// r := mux.NewRouter().NewRoute() +// url, err := r.Host("example.com") +// .Schemes("https", "http").URL() // // All variables defined in the route are required, and their values must // conform to the corresponding patterns. @@ -718,6 +728,25 @@ func (r *Route) GetHostTemplate() (string, error) { return r.regexp.host.template, nil } +// GetVarNames returns the names of all variables added by regexp matchers +// These can be used to know which route variables should be passed into r.URL() +func (r *Route) GetVarNames() ([]string, error) { + if r.err != nil { + return nil, r.err + } + var varNames []string + if r.regexp.host != nil { + varNames = append(varNames, r.regexp.host.varsN...) + } + if r.regexp.path != nil { + varNames = append(varNames, r.regexp.path.varsN...) + } + for _, regx := range r.regexp.queries { + varNames = append(varNames, regx.varsN...) + } + return varNames, nil +} + // prepareVars converts the route variable pairs into a map. If the route has a // BuildVarsFunc, it is invoked. func (r *Route) prepareVars(pairs ...string) (map[string]string, error) { diff --git a/vendor/github.com/gorilla/websocket/.editorconfig b/vendor/github.com/gorilla/websocket/.editorconfig new file mode 100644 index 0000000000..2940ec92ac --- /dev/null +++ b/vendor/github.com/gorilla/websocket/.editorconfig @@ -0,0 +1,20 @@ +; https://editorconfig.org/ + +root = true + +[*] +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[{Makefile,go.mod,go.sum,*.go,.gitmodules}] +indent_style = tab +indent_size = 4 + +[*.md] +indent_size = 4 +trim_trailing_whitespace = false + +eclint_indent_style = unset diff --git a/vendor/github.com/gorilla/websocket/.gitignore b/vendor/github.com/gorilla/websocket/.gitignore index cd3fcd1ef7..84039fec68 100644 --- a/vendor/github.com/gorilla/websocket/.gitignore +++ b/vendor/github.com/gorilla/websocket/.gitignore @@ -1,25 +1 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -.idea/ -*.iml +coverage.coverprofile diff --git a/vendor/github.com/gorilla/websocket/.golangci.yml b/vendor/github.com/gorilla/websocket/.golangci.yml new file mode 100644 index 0000000000..34882139e1 --- /dev/null +++ b/vendor/github.com/gorilla/websocket/.golangci.yml @@ -0,0 +1,3 @@ +run: + skip-dirs: + - examples/*.go diff --git a/vendor/github.com/gorilla/websocket/AUTHORS b/vendor/github.com/gorilla/websocket/AUTHORS deleted file mode 100644 index 1931f40068..0000000000 --- a/vendor/github.com/gorilla/websocket/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -# This is the official list of Gorilla WebSocket authors for copyright -# purposes. -# -# Please keep the list sorted. - -Gary Burd -Google LLC (https://opensource.google.com/) -Joachim Bauch - diff --git a/vendor/github.com/gorilla/websocket/LICENSE b/vendor/github.com/gorilla/websocket/LICENSE index 9171c97225..bb9d80bc9b 100644 --- a/vendor/github.com/gorilla/websocket/LICENSE +++ b/vendor/github.com/gorilla/websocket/LICENSE @@ -1,22 +1,27 @@ -Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. +Copyright (c) 2023 The Gorilla Authors. All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +modification, are permitted provided that the following conditions are +met: - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gorilla/websocket/Makefile b/vendor/github.com/gorilla/websocket/Makefile new file mode 100644 index 0000000000..603a63f50a --- /dev/null +++ b/vendor/github.com/gorilla/websocket/Makefile @@ -0,0 +1,34 @@ +GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '') +GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest + +GO_SEC=$(shell which gosec 2> /dev/null || echo '') +GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest + +GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '') +GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest + +.PHONY: golangci-lint +golangci-lint: + $(if $(GO_LINT), ,go install $(GO_LINT_URI)) + @echo "##### Running golangci-lint" + golangci-lint run -v + +.PHONY: gosec +gosec: + $(if $(GO_SEC), ,go install $(GO_SEC_URI)) + @echo "##### Running gosec" + gosec -exclude-dir examples ./... + +.PHONY: govulncheck +govulncheck: + $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI)) + @echo "##### Running govulncheck" + govulncheck ./... + +.PHONY: verify +verify: golangci-lint gosec govulncheck + +.PHONY: test +test: + @echo "##### Running tests" + go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./... diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md index 2517a28715..1fd5e9c4e7 100644 --- a/vendor/github.com/gorilla/websocket/README.md +++ b/vendor/github.com/gorilla/websocket/README.md @@ -1,17 +1,14 @@ -# Gorilla WebSocket +# gorilla/websocket -[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) -[![CircleCI](https://circleci.com/gh/gorilla/websocket.svg?style=svg)](https://circleci.com/gh/gorilla/websocket) +![testing](https://github.com/gorilla/websocket/actions/workflows/test.yml/badge.svg) +[![codecov](https://codecov.io/github/gorilla/websocket/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/websocket) +[![godoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) +[![sourcegraph](https://sourcegraph.com/github.com/gorilla/websocket/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/websocket?badge) -Gorilla WebSocket is a [Go](http://golang.org/) implementation of the -[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. +Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. +![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5) ---- - -⚠️ **[The Gorilla WebSocket Package is looking for a new maintainer](https://github.com/gorilla/websocket/issues/370)** - ---- ### Documentation @@ -20,6 +17,7 @@ Gorilla WebSocket is a [Go](http://golang.org/) implementation of the * [Command example](https://github.com/gorilla/websocket/tree/master/examples/command) * [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo) * [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch) +* [Write buffer pool example](https://github.com/gorilla/websocket/tree/master/examples/bufferpool) ### Status @@ -36,4 +34,3 @@ package API is stable. The Gorilla WebSocket package passes the server tests in the [Autobahn Test Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). - diff --git a/vendor/github.com/gorilla/websocket/client.go b/vendor/github.com/gorilla/websocket/client.go index 2efd83555d..815b0ca5c8 100644 --- a/vendor/github.com/gorilla/websocket/client.go +++ b/vendor/github.com/gorilla/websocket/client.go @@ -9,14 +9,18 @@ import ( "context" "crypto/tls" "errors" + "fmt" "io" - "io/ioutil" + "log" + "net" "net/http" "net/http/httptrace" "net/url" "strings" "time" + + "golang.org/x/net/proxy" ) // ErrBadHandshake is returned when the server response to opening handshake is @@ -224,6 +228,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h k == "Connection" || k == "Sec-Websocket-Key" || k == "Sec-Websocket-Version" || + //#nosec G101 (CWE-798): Potential HTTP request smuggling via parameter pollution k == "Sec-Websocket-Extensions" || (k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0): return nil, nil, errors.New("websocket: duplicate header not allowed: " + k) @@ -289,7 +294,9 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } err = c.SetDeadline(deadline) if err != nil { - c.Close() + if err := c.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } return nil, err } return c, nil @@ -303,7 +310,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h return nil, nil, err } if proxyURL != nil { - dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial)) + dialer, err := proxy.FromURL(proxyURL, netDialerFunc(netDial)) if err != nil { return nil, nil, err } @@ -318,18 +325,20 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } netConn, err := netDial("tcp", hostPort) + if err != nil { + return nil, nil, err + } if trace != nil && trace.GotConn != nil { trace.GotConn(httptrace.GotConnInfo{ Conn: netConn, }) } - if err != nil { - return nil, nil, err - } defer func() { if netConn != nil { - netConn.Close() + if err := netConn.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } } }() @@ -370,6 +379,17 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h resp, err := http.ReadResponse(conn.br, req) if err != nil { + if d.TLSClientConfig != nil { + for _, proto := range d.TLSClientConfig.NextProtos { + if proto != "http/1.1" { + return nil, nil, fmt.Errorf( + "websocket: protocol %q was given but is not supported;"+ + "sharing tls.Config with net/http Transport can cause this error: %w", + proto, err, + ) + } + } + } return nil, nil, err } @@ -388,7 +408,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h // debugging. buf := make([]byte, 1024) n, _ := io.ReadFull(resp.Body, buf) - resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n])) + resp.Body = io.NopCloser(bytes.NewReader(buf[:n])) return nil, resp, ErrBadHandshake } @@ -406,17 +426,19 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h break } - resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) + resp.Body = io.NopCloser(bytes.NewReader([]byte{})) conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol") - netConn.SetDeadline(time.Time{}) + if err := netConn.SetDeadline(time.Time{}); err != nil { + return nil, nil, err + } netConn = nil // to avoid close in defer. return conn, resp, nil } func cloneTLSConfig(cfg *tls.Config) *tls.Config { if cfg == nil { - return &tls.Config{} + return &tls.Config{MinVersion: tls.VersionTLS12} } return cfg.Clone() } diff --git a/vendor/github.com/gorilla/websocket/compression.go b/vendor/github.com/gorilla/websocket/compression.go index 813ffb1e84..9fed0ef521 100644 --- a/vendor/github.com/gorilla/websocket/compression.go +++ b/vendor/github.com/gorilla/websocket/compression.go @@ -8,6 +8,7 @@ import ( "compress/flate" "errors" "io" + "log" "strings" "sync" ) @@ -33,7 +34,9 @@ func decompressNoContextTakeover(r io.Reader) io.ReadCloser { "\x01\x00\x00\xff\xff" fr, _ := flateReaderPool.Get().(io.ReadCloser) - fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil) + if err := fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil); err != nil { + panic(err) + } return &flateReadWrapper{fr} } @@ -132,7 +135,9 @@ func (r *flateReadWrapper) Read(p []byte) (int, error) { // Preemptively place the reader back in the pool. This helps with // scenarios where the application does not call NextReader() soon after // this final read. - r.Close() + if err := r.Close(); err != nil { + log.Printf("websocket: flateReadWrapper.Close() returned error: %v", err) + } } return n, err } diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go index 331eebc850..221e6cf798 100644 --- a/vendor/github.com/gorilla/websocket/conn.go +++ b/vendor/github.com/gorilla/websocket/conn.go @@ -6,11 +6,11 @@ package websocket import ( "bufio" + "crypto/rand" "encoding/binary" "errors" "io" - "io/ioutil" - "math/rand" + "log" "net" "strconv" "strings" @@ -181,13 +181,20 @@ var ( errInvalidControlFrame = errors.New("websocket: invalid control frame") ) +// maskRand is an io.Reader for generating mask bytes. The reader is initialized +// to crypto/rand Reader. Tests swap the reader to a math/rand reader for +// reproducible results. +var maskRand = rand.Reader + +// newMaskKey returns a new 32 bit value for masking client frames. func newMaskKey() [4]byte { - n := rand.Uint32() - return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)} + var k [4]byte + _, _ = io.ReadFull(maskRand, k[:]) + return k } func hideTempErr(err error) error { - if e, ok := err.(net.Error); ok && e.Temporary() { + if e, ok := err.(net.Error); ok { err = &netError{msg: e.Error(), timeout: e.Timeout()} } return err @@ -372,7 +379,9 @@ func (c *Conn) read(n int) ([]byte, error) { if err == io.EOF { err = errUnexpectedEOF } - c.br.Discard(len(p)) + if _, err := c.br.Discard(len(p)); err != nil { + return p, err + } return p, err } @@ -387,7 +396,9 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error return err } - c.conn.SetWriteDeadline(deadline) + if err := c.conn.SetWriteDeadline(deadline); err != nil { + return c.writeFatal(err) + } if len(buf1) == 0 { _, err = c.conn.Write(buf0) } else { @@ -397,7 +408,7 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error return c.writeFatal(err) } if frameType == CloseMessage { - c.writeFatal(ErrCloseSent) + _ = c.writeFatal(ErrCloseSent) } return nil } @@ -438,7 +449,7 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er d := 1000 * time.Hour if !deadline.IsZero() { - d = deadline.Sub(time.Now()) + d = time.Until(deadline) if d < 0 { return errWriteTimeout } @@ -460,13 +471,15 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er return err } - c.conn.SetWriteDeadline(deadline) + if err := c.conn.SetWriteDeadline(deadline); err != nil { + return c.writeFatal(err) + } _, err = c.conn.Write(buf) if err != nil { return c.writeFatal(err) } if messageType == CloseMessage { - c.writeFatal(ErrCloseSent) + _ = c.writeFatal(ErrCloseSent) } return err } @@ -477,7 +490,9 @@ func (c *Conn) beginMessage(mw *messageWriter, messageType int) error { // probably better to return an error in this situation, but we cannot // change this without breaking existing applications. if c.writer != nil { - c.writer.Close() + if err := c.writer.Close(); err != nil { + log.Printf("websocket: discarding writer close error: %v", err) + } c.writer = nil } @@ -630,7 +645,7 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error { } if final { - w.endMessage(errWriteClosed) + _ = w.endMessage(errWriteClosed) return nil } @@ -795,7 +810,7 @@ func (c *Conn) advanceFrame() (int, error) { // 1. Skip remainder of previous frame. if c.readRemaining > 0 { - if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil { + if _, err := io.CopyN(io.Discard, c.br, c.readRemaining); err != nil { return noFrame, err } } @@ -817,7 +832,9 @@ func (c *Conn) advanceFrame() (int, error) { rsv2 := p[0]&rsv2Bit != 0 rsv3 := p[0]&rsv3Bit != 0 mask := p[1]&maskBit != 0 - c.setReadRemaining(int64(p[1] & 0x7f)) + if err := c.setReadRemaining(int64(p[1] & 0x7f)); err != nil { + return noFrame, err + } c.readDecompress = false if rsv1 { @@ -922,7 +939,9 @@ func (c *Conn) advanceFrame() (int, error) { } if c.readLimit > 0 && c.readLength > c.readLimit { - c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)) + if err := c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)); err != nil { + return noFrame, err + } return noFrame, ErrReadLimit } @@ -934,7 +953,9 @@ func (c *Conn) advanceFrame() (int, error) { var payload []byte if c.readRemaining > 0 { payload, err = c.read(int(c.readRemaining)) - c.setReadRemaining(0) + if err := c.setReadRemaining(0); err != nil { + return noFrame, err + } if err != nil { return noFrame, err } @@ -981,7 +1002,9 @@ func (c *Conn) handleProtocolError(message string) error { if len(data) > maxControlFramePayloadSize { data = data[:maxControlFramePayloadSize] } - c.WriteControl(CloseMessage, data, time.Now().Add(writeWait)) + if err := c.WriteControl(CloseMessage, data, time.Now().Add(writeWait)); err != nil { + return err + } return errors.New("websocket: " + message) } @@ -998,7 +1021,9 @@ func (c *Conn) handleProtocolError(message string) error { func (c *Conn) NextReader() (messageType int, r io.Reader, err error) { // Close previous reader, only relevant for decompression. if c.reader != nil { - c.reader.Close() + if err := c.reader.Close(); err != nil { + log.Printf("websocket: discarding reader close error: %v", err) + } c.reader = nil } @@ -1054,7 +1079,9 @@ func (r *messageReader) Read(b []byte) (int, error) { } rem := c.readRemaining rem -= int64(n) - c.setReadRemaining(rem) + if err := c.setReadRemaining(rem); err != nil { + return 0, err + } if c.readRemaining > 0 && c.readErr == io.EOF { c.readErr = errUnexpectedEOF } @@ -1094,7 +1121,7 @@ func (c *Conn) ReadMessage() (messageType int, p []byte, err error) { if err != nil { return messageType, nil, err } - p, err = ioutil.ReadAll(r) + p, err = io.ReadAll(r) return messageType, p, err } @@ -1136,7 +1163,9 @@ func (c *Conn) SetCloseHandler(h func(code int, text string) error) { if h == nil { h = func(code int, text string) error { message := FormatCloseMessage(code, "") - c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)) + if err := c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)); err != nil { + return err + } return nil } } @@ -1161,7 +1190,7 @@ func (c *Conn) SetPingHandler(h func(appData string) error) { err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait)) if err == ErrCloseSent { return nil - } else if e, ok := err.(net.Error); ok && e.Temporary() { + } else if _, ok := err.(net.Error); ok { return nil } return err @@ -1189,8 +1218,16 @@ func (c *Conn) SetPongHandler(h func(appData string) error) { c.handlePong = h } +// NetConn returns the underlying connection that is wrapped by c. +// Note that writing to or reading from this connection directly will corrupt the +// WebSocket connection. +func (c *Conn) NetConn() net.Conn { + return c.conn +} + // UnderlyingConn returns the internal net.Conn. This can be used to further // modifications to connection specific flags. +// Deprecated: Use the NetConn method. func (c *Conn) UnderlyingConn() net.Conn { return c.conn } diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go index d0742bf2a5..67d0968be8 100644 --- a/vendor/github.com/gorilla/websocket/mask.go +++ b/vendor/github.com/gorilla/websocket/mask.go @@ -9,6 +9,7 @@ package websocket import "unsafe" +// #nosec G103 -- (CWE-242) Has been audited const wordSize = int(unsafe.Sizeof(uintptr(0))) func maskBytes(key [4]byte, pos int, b []byte) int { @@ -22,6 +23,7 @@ func maskBytes(key [4]byte, pos int, b []byte) int { } // Mask one byte at a time to word boundary. + //#nosec G103 -- (CWE-242) Has been audited if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 { n = wordSize - n for i := range b[:n] { @@ -36,11 +38,13 @@ func maskBytes(key [4]byte, pos int, b []byte) int { for i := range k { k[i] = key[(pos+i)&3] } + //#nosec G103 -- (CWE-242) Has been audited kw := *(*uintptr)(unsafe.Pointer(&k)) // Mask one word at a time. n := (len(b) / wordSize) * wordSize for i := 0; i < n; i += wordSize { + //#nosec G103 -- (CWE-242) Has been audited *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw } diff --git a/vendor/github.com/gorilla/websocket/proxy.go b/vendor/github.com/gorilla/websocket/proxy.go index e0f466b72f..80f55d1eac 100644 --- a/vendor/github.com/gorilla/websocket/proxy.go +++ b/vendor/github.com/gorilla/websocket/proxy.go @@ -8,10 +8,13 @@ import ( "bufio" "encoding/base64" "errors" + "log" "net" "net/http" "net/url" "strings" + + "golang.org/x/net/proxy" ) type netDialerFunc func(network, addr string) (net.Conn, error) @@ -21,7 +24,7 @@ func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) { } func init() { - proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) { + proxy.RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy.Dialer) (proxy.Dialer, error) { return &httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDialer.Dial}, nil }) } @@ -55,7 +58,9 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) } if err := connectReq.Write(conn); err != nil { - conn.Close() + if err := conn.Close(); err != nil { + log.Printf("httpProxyDialer: failed to close connection: %v", err) + } return nil, err } @@ -64,12 +69,16 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) br := bufio.NewReader(conn) resp, err := http.ReadResponse(br, connectReq) if err != nil { - conn.Close() + if err := conn.Close(); err != nil { + log.Printf("httpProxyDialer: failed to close connection: %v", err) + } return nil, err } if resp.StatusCode != 200 { - conn.Close() + if err := conn.Close(); err != nil { + log.Printf("httpProxyDialer: failed to close connection: %v", err) + } f := strings.SplitN(resp.Status, " ", 2) return nil, errors.New(f[1]) } diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go index 24d53b38ab..1e720e1da4 100644 --- a/vendor/github.com/gorilla/websocket/server.go +++ b/vendor/github.com/gorilla/websocket/server.go @@ -8,6 +8,7 @@ import ( "bufio" "errors" "io" + "log" "net/http" "net/url" "strings" @@ -154,8 +155,8 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade } challengeKey := r.Header.Get("Sec-Websocket-Key") - if challengeKey == "" { - return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header is missing or blank") + if !isValidChallengeKey(challengeKey) { + return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header must be Base64 encoded value of 16-byte in length") } subprotocol := u.selectSubprotocol(r, responseHeader) @@ -183,7 +184,9 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade } if brw.Reader.Buffered() > 0 { - netConn.Close() + if err := netConn.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } return nil, errors.New("websocket: client sent data before handshake is complete") } @@ -248,17 +251,34 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade p = append(p, "\r\n"...) // Clear deadlines set by HTTP server. - netConn.SetDeadline(time.Time{}) + if err := netConn.SetDeadline(time.Time{}); err != nil { + if err := netConn.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } + return nil, err + } if u.HandshakeTimeout > 0 { - netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)) + if err := netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)); err != nil { + if err := netConn.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } + return nil, err + } } if _, err = netConn.Write(p); err != nil { - netConn.Close() + if err := netConn.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } return nil, err } if u.HandshakeTimeout > 0 { - netConn.SetWriteDeadline(time.Time{}) + if err := netConn.SetWriteDeadline(time.Time{}); err != nil { + if err := netConn.Close(); err != nil { + log.Printf("websocket: failed to close network connection: %v", err) + } + return nil, err + } } return c, nil @@ -356,8 +376,12 @@ func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte { // bufio.Writer's underlying writer. var wh writeHook bw.Reset(&wh) - bw.WriteByte(0) - bw.Flush() + if err := bw.WriteByte(0); err != nil { + panic(err) + } + if err := bw.Flush(); err != nil { + log.Printf("websocket: bufioWriterBuffer: Flush: %v", err) + } bw.Reset(originalWriter) diff --git a/vendor/github.com/gorilla/websocket/tls_handshake.go b/vendor/github.com/gorilla/websocket/tls_handshake.go index a62b68ccb1..7f38645348 100644 --- a/vendor/github.com/gorilla/websocket/tls_handshake.go +++ b/vendor/github.com/gorilla/websocket/tls_handshake.go @@ -1,6 +1,3 @@ -//go:build go1.17 -// +build go1.17 - package websocket import ( diff --git a/vendor/github.com/gorilla/websocket/tls_handshake_116.go b/vendor/github.com/gorilla/websocket/tls_handshake_116.go deleted file mode 100644 index e1b2b44f6e..0000000000 --- a/vendor/github.com/gorilla/websocket/tls_handshake_116.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build !go1.17 -// +build !go1.17 - -package websocket - -import ( - "context" - "crypto/tls" -) - -func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error { - if err := tlsConn.Handshake(); err != nil { - return err - } - if !cfg.InsecureSkipVerify { - if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/gorilla/websocket/util.go b/vendor/github.com/gorilla/websocket/util.go index 7bf2f66c67..9b1a629bff 100644 --- a/vendor/github.com/gorilla/websocket/util.go +++ b/vendor/github.com/gorilla/websocket/util.go @@ -6,7 +6,7 @@ package websocket import ( "crypto/rand" - "crypto/sha1" + "crypto/sha1" //#nosec G505 -- (CWE-327) https://datatracker.ietf.org/doc/html/rfc6455#page-54 "encoding/base64" "io" "net/http" @@ -17,7 +17,7 @@ import ( var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") func computeAcceptKey(challengeKey string) string { - h := sha1.New() + h := sha1.New() //#nosec G401 -- (CWE-326) https://datatracker.ietf.org/doc/html/rfc6455#page-54 h.Write([]byte(challengeKey)) h.Write(keyGUID) return base64.StdEncoding.EncodeToString(h.Sum(nil)) @@ -281,3 +281,18 @@ headers: } return result } + +// isValidChallengeKey checks if the argument meets RFC6455 specification. +func isValidChallengeKey(s string) bool { + // From RFC6455: + // + // A |Sec-WebSocket-Key| header field with a base64-encoded (see + // Section 4 of [RFC4648]) value that, when decoded, is 16 bytes in + // length. + + if s == "" { + return false + } + decoded, err := base64.StdEncoding.DecodeString(s) + return err == nil && len(decoded) == 16 +} diff --git a/vendor/github.com/gorilla/websocket/x_net_proxy.go b/vendor/github.com/gorilla/websocket/x_net_proxy.go deleted file mode 100644 index 2e668f6b88..0000000000 --- a/vendor/github.com/gorilla/websocket/x_net_proxy.go +++ /dev/null @@ -1,473 +0,0 @@ -// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT. -//go:generate bundle -o x_net_proxy.go golang.org/x/net/proxy - -// Package proxy provides support for a variety of protocols to proxy network -// data. -// - -package websocket - -import ( - "errors" - "io" - "net" - "net/url" - "os" - "strconv" - "strings" - "sync" -) - -type proxy_direct struct{} - -// Direct is a direct proxy: one that makes network connections directly. -var proxy_Direct = proxy_direct{} - -func (proxy_direct) Dial(network, addr string) (net.Conn, error) { - return net.Dial(network, addr) -} - -// A PerHost directs connections to a default Dialer unless the host name -// requested matches one of a number of exceptions. -type proxy_PerHost struct { - def, bypass proxy_Dialer - - bypassNetworks []*net.IPNet - bypassIPs []net.IP - bypassZones []string - bypassHosts []string -} - -// NewPerHost returns a PerHost Dialer that directs connections to either -// defaultDialer or bypass, depending on whether the connection matches one of -// the configured rules. -func proxy_NewPerHost(defaultDialer, bypass proxy_Dialer) *proxy_PerHost { - return &proxy_PerHost{ - def: defaultDialer, - bypass: bypass, - } -} - -// Dial connects to the address addr on the given network through either -// defaultDialer or bypass. -func (p *proxy_PerHost) Dial(network, addr string) (c net.Conn, err error) { - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - - return p.dialerForRequest(host).Dial(network, addr) -} - -func (p *proxy_PerHost) dialerForRequest(host string) proxy_Dialer { - if ip := net.ParseIP(host); ip != nil { - for _, net := range p.bypassNetworks { - if net.Contains(ip) { - return p.bypass - } - } - for _, bypassIP := range p.bypassIPs { - if bypassIP.Equal(ip) { - return p.bypass - } - } - return p.def - } - - for _, zone := range p.bypassZones { - if strings.HasSuffix(host, zone) { - return p.bypass - } - if host == zone[1:] { - // For a zone ".example.com", we match "example.com" - // too. - return p.bypass - } - } - for _, bypassHost := range p.bypassHosts { - if bypassHost == host { - return p.bypass - } - } - return p.def -} - -// AddFromString parses a string that contains comma-separated values -// specifying hosts that should use the bypass proxy. Each value is either an -// IP address, a CIDR range, a zone (*.example.com) or a host name -// (localhost). A best effort is made to parse the string and errors are -// ignored. -func (p *proxy_PerHost) AddFromString(s string) { - hosts := strings.Split(s, ",") - for _, host := range hosts { - host = strings.TrimSpace(host) - if len(host) == 0 { - continue - } - if strings.Contains(host, "/") { - // We assume that it's a CIDR address like 127.0.0.0/8 - if _, net, err := net.ParseCIDR(host); err == nil { - p.AddNetwork(net) - } - continue - } - if ip := net.ParseIP(host); ip != nil { - p.AddIP(ip) - continue - } - if strings.HasPrefix(host, "*.") { - p.AddZone(host[1:]) - continue - } - p.AddHost(host) - } -} - -// AddIP specifies an IP address that will use the bypass proxy. Note that -// this will only take effect if a literal IP address is dialed. A connection -// to a named host will never match an IP. -func (p *proxy_PerHost) AddIP(ip net.IP) { - p.bypassIPs = append(p.bypassIPs, ip) -} - -// AddNetwork specifies an IP range that will use the bypass proxy. Note that -// this will only take effect if a literal IP address is dialed. A connection -// to a named host will never match. -func (p *proxy_PerHost) AddNetwork(net *net.IPNet) { - p.bypassNetworks = append(p.bypassNetworks, net) -} - -// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of -// "example.com" matches "example.com" and all of its subdomains. -func (p *proxy_PerHost) AddZone(zone string) { - if strings.HasSuffix(zone, ".") { - zone = zone[:len(zone)-1] - } - if !strings.HasPrefix(zone, ".") { - zone = "." + zone - } - p.bypassZones = append(p.bypassZones, zone) -} - -// AddHost specifies a host name that will use the bypass proxy. -func (p *proxy_PerHost) AddHost(host string) { - if strings.HasSuffix(host, ".") { - host = host[:len(host)-1] - } - p.bypassHosts = append(p.bypassHosts, host) -} - -// A Dialer is a means to establish a connection. -type proxy_Dialer interface { - // Dial connects to the given address via the proxy. - Dial(network, addr string) (c net.Conn, err error) -} - -// Auth contains authentication parameters that specific Dialers may require. -type proxy_Auth struct { - User, Password string -} - -// FromEnvironment returns the dialer specified by the proxy related variables in -// the environment. -func proxy_FromEnvironment() proxy_Dialer { - allProxy := proxy_allProxyEnv.Get() - if len(allProxy) == 0 { - return proxy_Direct - } - - proxyURL, err := url.Parse(allProxy) - if err != nil { - return proxy_Direct - } - proxy, err := proxy_FromURL(proxyURL, proxy_Direct) - if err != nil { - return proxy_Direct - } - - noProxy := proxy_noProxyEnv.Get() - if len(noProxy) == 0 { - return proxy - } - - perHost := proxy_NewPerHost(proxy, proxy_Direct) - perHost.AddFromString(noProxy) - return perHost -} - -// proxySchemes is a map from URL schemes to a function that creates a Dialer -// from a URL with such a scheme. -var proxy_proxySchemes map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error) - -// RegisterDialerType takes a URL scheme and a function to generate Dialers from -// a URL with that scheme and a forwarding Dialer. Registered schemes are used -// by FromURL. -func proxy_RegisterDialerType(scheme string, f func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) { - if proxy_proxySchemes == nil { - proxy_proxySchemes = make(map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) - } - proxy_proxySchemes[scheme] = f -} - -// FromURL returns a Dialer given a URL specification and an underlying -// Dialer for it to make network requests. -func proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) { - var auth *proxy_Auth - if u.User != nil { - auth = new(proxy_Auth) - auth.User = u.User.Username() - if p, ok := u.User.Password(); ok { - auth.Password = p - } - } - - switch u.Scheme { - case "socks5": - return proxy_SOCKS5("tcp", u.Host, auth, forward) - } - - // If the scheme doesn't match any of the built-in schemes, see if it - // was registered by another package. - if proxy_proxySchemes != nil { - if f, ok := proxy_proxySchemes[u.Scheme]; ok { - return f(u, forward) - } - } - - return nil, errors.New("proxy: unknown scheme: " + u.Scheme) -} - -var ( - proxy_allProxyEnv = &proxy_envOnce{ - names: []string{"ALL_PROXY", "all_proxy"}, - } - proxy_noProxyEnv = &proxy_envOnce{ - names: []string{"NO_PROXY", "no_proxy"}, - } -) - -// envOnce looks up an environment variable (optionally by multiple -// names) once. It mitigates expensive lookups on some platforms -// (e.g. Windows). -// (Borrowed from net/http/transport.go) -type proxy_envOnce struct { - names []string - once sync.Once - val string -} - -func (e *proxy_envOnce) Get() string { - e.once.Do(e.init) - return e.val -} - -func (e *proxy_envOnce) init() { - for _, n := range e.names { - e.val = os.Getenv(n) - if e.val != "" { - return - } - } -} - -// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address -// with an optional username and password. See RFC 1928 and RFC 1929. -func proxy_SOCKS5(network, addr string, auth *proxy_Auth, forward proxy_Dialer) (proxy_Dialer, error) { - s := &proxy_socks5{ - network: network, - addr: addr, - forward: forward, - } - if auth != nil { - s.user = auth.User - s.password = auth.Password - } - - return s, nil -} - -type proxy_socks5 struct { - user, password string - network, addr string - forward proxy_Dialer -} - -const proxy_socks5Version = 5 - -const ( - proxy_socks5AuthNone = 0 - proxy_socks5AuthPassword = 2 -) - -const proxy_socks5Connect = 1 - -const ( - proxy_socks5IP4 = 1 - proxy_socks5Domain = 3 - proxy_socks5IP6 = 4 -) - -var proxy_socks5Errors = []string{ - "", - "general failure", - "connection forbidden", - "network unreachable", - "host unreachable", - "connection refused", - "TTL expired", - "command not supported", - "address type not supported", -} - -// Dial connects to the address addr on the given network via the SOCKS5 proxy. -func (s *proxy_socks5) Dial(network, addr string) (net.Conn, error) { - switch network { - case "tcp", "tcp6", "tcp4": - default: - return nil, errors.New("proxy: no support for SOCKS5 proxy connections of type " + network) - } - - conn, err := s.forward.Dial(s.network, s.addr) - if err != nil { - return nil, err - } - if err := s.connect(conn, addr); err != nil { - conn.Close() - return nil, err - } - return conn, nil -} - -// connect takes an existing connection to a socks5 proxy server, -// and commands the server to extend that connection to target, -// which must be a canonical address with a host and port. -func (s *proxy_socks5) connect(conn net.Conn, target string) error { - host, portStr, err := net.SplitHostPort(target) - if err != nil { - return err - } - - port, err := strconv.Atoi(portStr) - if err != nil { - return errors.New("proxy: failed to parse port number: " + portStr) - } - if port < 1 || port > 0xffff { - return errors.New("proxy: port number out of range: " + portStr) - } - - // the size here is just an estimate - buf := make([]byte, 0, 6+len(host)) - - buf = append(buf, proxy_socks5Version) - if len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 { - buf = append(buf, 2 /* num auth methods */, proxy_socks5AuthNone, proxy_socks5AuthPassword) - } else { - buf = append(buf, 1 /* num auth methods */, proxy_socks5AuthNone) - } - - if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - if buf[0] != 5 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0]))) - } - if buf[1] == 0xff { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication") - } - - // See RFC 1929 - if buf[1] == proxy_socks5AuthPassword { - buf = buf[:0] - buf = append(buf, 1 /* password protocol version */) - buf = append(buf, uint8(len(s.user))) - buf = append(buf, s.user...) - buf = append(buf, uint8(len(s.password))) - buf = append(buf, s.password...) - - if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if buf[1] != 0 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password") - } - } - - buf = buf[:0] - buf = append(buf, proxy_socks5Version, proxy_socks5Connect, 0 /* reserved */) - - if ip := net.ParseIP(host); ip != nil { - if ip4 := ip.To4(); ip4 != nil { - buf = append(buf, proxy_socks5IP4) - ip = ip4 - } else { - buf = append(buf, proxy_socks5IP6) - } - buf = append(buf, ip...) - } else { - if len(host) > 255 { - return errors.New("proxy: destination host name too long: " + host) - } - buf = append(buf, proxy_socks5Domain) - buf = append(buf, byte(len(host))) - buf = append(buf, host...) - } - buf = append(buf, byte(port>>8), byte(port)) - - if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if _, err := io.ReadFull(conn, buf[:4]); err != nil { - return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - failure := "unknown error" - if int(buf[1]) < len(proxy_socks5Errors) { - failure = proxy_socks5Errors[buf[1]] - } - - if len(failure) > 0 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure) - } - - bytesToDiscard := 0 - switch buf[3] { - case proxy_socks5IP4: - bytesToDiscard = net.IPv4len - case proxy_socks5IP6: - bytesToDiscard = net.IPv6len - case proxy_socks5Domain: - _, err := io.ReadFull(conn, buf[:1]) - if err != nil { - return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - bytesToDiscard = int(buf[0]) - default: - return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr) - } - - if cap(buf) < bytesToDiscard { - buf = make([]byte, bytesToDiscard) - } else { - buf = buf[:bytesToDiscard] - } - if _, err := io.ReadFull(conn, buf); err != nil { - return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - // Also need to discard the port number - if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - return nil -} diff --git a/vendor/github.com/longhorn/backupstore/config.go b/vendor/github.com/longhorn/backupstore/config.go index 35cd5a5258..a996ba0dbc 100644 --- a/vendor/github.com/longhorn/backupstore/config.go +++ b/vendor/github.com/longhorn/backupstore/config.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "path/filepath" + "runtime" "strings" "time" @@ -139,6 +140,27 @@ func volumeExists(driver BackupStoreDriver, volumeName string) bool { return driver.FileExists(getVolumeFilePath(volumeName)) } +// volumeFolderExists checks if volume folder exists on backupstore +// by listing all the backup volume name based on the folders on the backupstore +// since s3 does not support checking folder exist. +func volumeFolderExists(driver BackupStoreDriver, volumeName string) (bool, error) { + jobQueues := workerpool.New(runtime.NumCPU() * 16) + defer jobQueues.StopWait() + + volumeNames, err := getVolumeNames(jobQueues, driver) + if err != nil { + return false, err + } + + for _, name := range volumeNames { + if volumeName == name { + return true, nil + } + } + + return false, nil +} + func getVolumePath(volumeName string) string { checksum := util.GetChecksum([]byte(volumeName)) volumeLayer1 := checksum[0:VOLUME_SEPARATE_LAYER1] diff --git a/vendor/github.com/longhorn/backupstore/deltablock.go b/vendor/github.com/longhorn/backupstore/deltablock.go index d011b3a2a0..73851e53b5 100644 --- a/vendor/github.com/longhorn/backupstore/deltablock.go +++ b/vendor/github.com/longhorn/backupstore/deltablock.go @@ -1051,6 +1051,17 @@ func DeleteBackupVolume(volumeName string, destURL string) error { if err != nil { return err } + + backupVolumeFolderExists, err := volumeFolderExists(bsDriver, volumeName) + if err != nil { + return err + } + + // No need to lock and remove volume if it does not exist. + if !backupVolumeFolderExists { + return nil + } + lock, err := New(bsDriver, volumeName, DELETION_LOCK) if err != nil { return err diff --git a/vendor/github.com/longhorn/longhorn-share-manager/pkg/rpc/server.go b/vendor/github.com/longhorn/longhorn-share-manager/pkg/rpc/server.go index 7bb69db786..c7b28343c9 100644 --- a/vendor/github.com/longhorn/longhorn-share-manager/pkg/rpc/server.go +++ b/vendor/github.com/longhorn/longhorn-share-manager/pkg/rpc/server.go @@ -7,7 +7,6 @@ import ( "sync" "time" - "github.com/golang/protobuf/ptypes/empty" "github.com/google/fscrypt/filesystem" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -20,7 +19,7 @@ import ( grpcstatus "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" - lhns "github.com/longhorn/go-common-libs/ns" + lhexec "github.com/longhorn/go-common-libs/exec" lhtypes "github.com/longhorn/go-common-libs/types" "github.com/longhorn/longhorn-share-manager/pkg/server" @@ -105,13 +104,8 @@ func (s *ShareManagerServer) FilesystemTrim(ctx context.Context, req *Filesystem return &emptypb.Empty{}, grpcstatus.Error(grpccodes.Internal, err.Error()) } - namespaces := []lhtypes.Namespace{lhtypes.NamespaceMnt, lhtypes.NamespaceNet} - nsexec, err := lhns.NewNamespaceExecutor(lhns.GetDefaultProcessName(), lhtypes.HostProcDirectory, namespaces) - if err != nil { - return &empty.Empty{}, grpcstatus.Error(grpccodes.Internal, err.Error()) - } - - _, err = nsexec.Execute(lhtypes.BinaryFstrim, []string{mountPath}, lhtypes.ExecuteDefaultTimeout) + execute := lhexec.NewExecutor().Execute + _, err = execute([]string{}, lhtypes.BinaryFstrim, []string{mountPath}, lhtypes.ExecuteDefaultTimeout) if err != nil { return &emptypb.Empty{}, grpcstatus.Error(grpccodes.Internal, err.Error()) } diff --git a/vendor/github.com/mitchellh/copystructure/README.md b/vendor/github.com/mitchellh/copystructure/README.md deleted file mode 100644 index f0fbd2e5c9..0000000000 --- a/vendor/github.com/mitchellh/copystructure/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# copystructure - -copystructure is a Go library for deep copying values in Go. - -This allows you to copy Go values that may contain reference values -such as maps, slices, or pointers, and copy their data as well instead -of just their references. - -## Installation - -Standard `go get`: - -``` -$ go get github.com/mitchellh/copystructure -``` - -## Usage & Example - -For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/copystructure). - -The `Copy` function has examples associated with it there. diff --git a/vendor/github.com/mitchellh/copystructure/copier_time.go b/vendor/github.com/mitchellh/copystructure/copier_time.go deleted file mode 100644 index db6a6aa1a1..0000000000 --- a/vendor/github.com/mitchellh/copystructure/copier_time.go +++ /dev/null @@ -1,15 +0,0 @@ -package copystructure - -import ( - "reflect" - "time" -) - -func init() { - Copiers[reflect.TypeOf(time.Time{})] = timeCopier -} - -func timeCopier(v interface{}) (interface{}, error) { - // Just... copy it. - return v.(time.Time), nil -} diff --git a/vendor/github.com/mitchellh/copystructure/copystructure.go b/vendor/github.com/mitchellh/copystructure/copystructure.go deleted file mode 100644 index 8089e6670a..0000000000 --- a/vendor/github.com/mitchellh/copystructure/copystructure.go +++ /dev/null @@ -1,631 +0,0 @@ -package copystructure - -import ( - "errors" - "reflect" - "sync" - - "github.com/mitchellh/reflectwalk" -) - -const tagKey = "copy" - -// Copy returns a deep copy of v. -// -// Copy is unable to copy unexported fields in a struct (lowercase field names). -// Unexported fields can't be reflected by the Go runtime and therefore -// copystructure can't perform any data copies. -// -// For structs, copy behavior can be controlled with struct tags. For example: -// -// struct { -// Name string -// Data *bytes.Buffer `copy:"shallow"` -// } -// -// The available tag values are: -// -// * "ignore" - The field will be ignored, effectively resulting in it being -// assigned the zero value in the copy. -// -// * "shallow" - The field will be be shallow copied. This means that references -// values such as pointers, maps, slices, etc. will be directly assigned -// versus deep copied. -// -func Copy(v interface{}) (interface{}, error) { - return Config{}.Copy(v) -} - -// CopierFunc is a function that knows how to deep copy a specific type. -// Register these globally with the Copiers variable. -type CopierFunc func(interface{}) (interface{}, error) - -// Copiers is a map of types that behave specially when they are copied. -// If a type is found in this map while deep copying, this function -// will be called to copy it instead of attempting to copy all fields. -// -// The key should be the type, obtained using: reflect.TypeOf(value with type). -// -// It is unsafe to write to this map after Copies have started. If you -// are writing to this map while also copying, wrap all modifications to -// this map as well as to Copy in a mutex. -var Copiers map[reflect.Type]CopierFunc = make(map[reflect.Type]CopierFunc) - -// ShallowCopiers is a map of pointer types that behave specially -// when they are copied. If a type is found in this map while deep -// copying, the pointer value will be shallow copied and not walked -// into. -// -// The key should be the type, obtained using: reflect.TypeOf(value -// with type). -// -// It is unsafe to write to this map after Copies have started. If you -// are writing to this map while also copying, wrap all modifications to -// this map as well as to Copy in a mutex. -var ShallowCopiers map[reflect.Type]struct{} = make(map[reflect.Type]struct{}) - -// Must is a helper that wraps a call to a function returning -// (interface{}, error) and panics if the error is non-nil. It is intended -// for use in variable initializations and should only be used when a copy -// error should be a crashing case. -func Must(v interface{}, err error) interface{} { - if err != nil { - panic("copy error: " + err.Error()) - } - - return v -} - -var errPointerRequired = errors.New("Copy argument must be a pointer when Lock is true") - -type Config struct { - // Lock any types that are a sync.Locker and are not a mutex while copying. - // If there is an RLocker method, use that to get the sync.Locker. - Lock bool - - // Copiers is a map of types associated with a CopierFunc. Use the global - // Copiers map if this is nil. - Copiers map[reflect.Type]CopierFunc - - // ShallowCopiers is a map of pointer types that when they are - // shallow copied no matter where they are encountered. Use the - // global ShallowCopiers if this is nil. - ShallowCopiers map[reflect.Type]struct{} -} - -func (c Config) Copy(v interface{}) (interface{}, error) { - if c.Lock && reflect.ValueOf(v).Kind() != reflect.Ptr { - return nil, errPointerRequired - } - - w := new(walker) - if c.Lock { - w.useLocks = true - } - - if c.Copiers == nil { - c.Copiers = Copiers - } - w.copiers = c.Copiers - - if c.ShallowCopiers == nil { - c.ShallowCopiers = ShallowCopiers - } - w.shallowCopiers = c.ShallowCopiers - - err := reflectwalk.Walk(v, w) - if err != nil { - return nil, err - } - - // Get the result. If the result is nil, then we want to turn it - // into a typed nil if we can. - result := w.Result - if result == nil { - val := reflect.ValueOf(v) - result = reflect.Indirect(reflect.New(val.Type())).Interface() - } - - return result, nil -} - -// Return the key used to index interfaces types we've seen. Store the number -// of pointers in the upper 32bits, and the depth in the lower 32bits. This is -// easy to calculate, easy to match a key with our current depth, and we don't -// need to deal with initializing and cleaning up nested maps or slices. -func ifaceKey(pointers, depth int) uint64 { - return uint64(pointers)<<32 | uint64(depth) -} - -type walker struct { - Result interface{} - - copiers map[reflect.Type]CopierFunc - shallowCopiers map[reflect.Type]struct{} - depth int - ignoreDepth int - vals []reflect.Value - cs []reflect.Value - - // This stores the number of pointers we've walked over, indexed by depth. - ps []int - - // If an interface is indirected by a pointer, we need to know the type of - // interface to create when creating the new value. Store the interface - // types here, indexed by both the walk depth and the number of pointers - // already seen at that depth. Use ifaceKey to calculate the proper uint64 - // value. - ifaceTypes map[uint64]reflect.Type - - // any locks we've taken, indexed by depth - locks []sync.Locker - // take locks while walking the structure - useLocks bool -} - -func (w *walker) Enter(l reflectwalk.Location) error { - w.depth++ - - // ensure we have enough elements to index via w.depth - for w.depth >= len(w.locks) { - w.locks = append(w.locks, nil) - } - - for len(w.ps) < w.depth+1 { - w.ps = append(w.ps, 0) - } - - return nil -} - -func (w *walker) Exit(l reflectwalk.Location) error { - locker := w.locks[w.depth] - w.locks[w.depth] = nil - if locker != nil { - defer locker.Unlock() - } - - // clear out pointers and interfaces as we exit the stack - w.ps[w.depth] = 0 - - for k := range w.ifaceTypes { - mask := uint64(^uint32(0)) - if k&mask == uint64(w.depth) { - delete(w.ifaceTypes, k) - } - } - - w.depth-- - if w.ignoreDepth > w.depth { - w.ignoreDepth = 0 - } - - if w.ignoring() { - return nil - } - - switch l { - case reflectwalk.Array: - fallthrough - case reflectwalk.Map: - fallthrough - case reflectwalk.Slice: - w.replacePointerMaybe() - - // Pop map off our container - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.MapValue: - // Pop off the key and value - mv := w.valPop() - mk := w.valPop() - m := w.cs[len(w.cs)-1] - - // If mv is the zero value, SetMapIndex deletes the key form the map, - // or in this case never adds it. We need to create a properly typed - // zero value so that this key can be set. - if !mv.IsValid() { - mv = reflect.Zero(m.Elem().Type().Elem()) - } - m.Elem().SetMapIndex(mk, mv) - case reflectwalk.ArrayElem: - // Pop off the value and the index and set it on the array - v := w.valPop() - i := w.valPop().Interface().(int) - if v.IsValid() { - a := w.cs[len(w.cs)-1] - ae := a.Elem().Index(i) // storing array as pointer on stack - so need Elem() call - if ae.CanSet() { - ae.Set(v) - } - } - case reflectwalk.SliceElem: - // Pop off the value and the index and set it on the slice - v := w.valPop() - i := w.valPop().Interface().(int) - if v.IsValid() { - s := w.cs[len(w.cs)-1] - se := s.Elem().Index(i) - if se.CanSet() { - se.Set(v) - } - } - case reflectwalk.Struct: - w.replacePointerMaybe() - - // Remove the struct from the container stack - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.StructField: - // Pop off the value and the field - v := w.valPop() - f := w.valPop().Interface().(reflect.StructField) - if v.IsValid() { - s := w.cs[len(w.cs)-1] - sf := reflect.Indirect(s).FieldByName(f.Name) - - if sf.CanSet() { - sf.Set(v) - } - } - case reflectwalk.WalkLoc: - // Clear out the slices for GC - w.cs = nil - w.vals = nil - } - - return nil -} - -func (w *walker) Map(m reflect.Value) error { - if w.ignoring() { - return nil - } - w.lock(m) - - // Create the map. If the map itself is nil, then just make a nil map - var newMap reflect.Value - if m.IsNil() { - newMap = reflect.New(m.Type()) - } else { - newMap = wrapPtr(reflect.MakeMap(m.Type())) - } - - w.cs = append(w.cs, newMap) - w.valPush(newMap) - return nil -} - -func (w *walker) MapElem(m, k, v reflect.Value) error { - return nil -} - -func (w *walker) PointerEnter(v bool) error { - if v { - w.ps[w.depth]++ - } - return nil -} - -func (w *walker) PointerExit(v bool) error { - if v { - w.ps[w.depth]-- - } - return nil -} - -func (w *walker) Pointer(v reflect.Value) error { - if _, ok := w.shallowCopiers[v.Type()]; ok { - // Shallow copy this value. Use the same logic as primitive, then - // return skip. - if err := w.Primitive(v); err != nil { - return err - } - - return reflectwalk.SkipEntry - } - - return nil -} - -func (w *walker) Interface(v reflect.Value) error { - if !v.IsValid() { - return nil - } - if w.ifaceTypes == nil { - w.ifaceTypes = make(map[uint64]reflect.Type) - } - - w.ifaceTypes[ifaceKey(w.ps[w.depth], w.depth)] = v.Type() - return nil -} - -func (w *walker) Primitive(v reflect.Value) error { - if w.ignoring() { - return nil - } - w.lock(v) - - // IsValid verifies the v is non-zero and CanInterface verifies - // that we're allowed to read this value (unexported fields). - var newV reflect.Value - if v.IsValid() && v.CanInterface() { - newV = reflect.New(v.Type()) - newV.Elem().Set(v) - } - - w.valPush(newV) - w.replacePointerMaybe() - return nil -} - -func (w *walker) Slice(s reflect.Value) error { - if w.ignoring() { - return nil - } - w.lock(s) - - var newS reflect.Value - if s.IsNil() { - newS = reflect.New(s.Type()) - } else { - newS = wrapPtr(reflect.MakeSlice(s.Type(), s.Len(), s.Cap())) - } - - w.cs = append(w.cs, newS) - w.valPush(newS) - return nil -} - -func (w *walker) SliceElem(i int, elem reflect.Value) error { - if w.ignoring() { - return nil - } - - // We don't write the slice here because elem might still be - // arbitrarily complex. Just record the index and continue on. - w.valPush(reflect.ValueOf(i)) - - return nil -} - -func (w *walker) Array(a reflect.Value) error { - if w.ignoring() { - return nil - } - w.lock(a) - - newA := reflect.New(a.Type()) - - w.cs = append(w.cs, newA) - w.valPush(newA) - return nil -} - -func (w *walker) ArrayElem(i int, elem reflect.Value) error { - if w.ignoring() { - return nil - } - - // We don't write the array here because elem might still be - // arbitrarily complex. Just record the index and continue on. - w.valPush(reflect.ValueOf(i)) - - return nil -} - -func (w *walker) Struct(s reflect.Value) error { - if w.ignoring() { - return nil - } - w.lock(s) - - var v reflect.Value - if c, ok := w.copiers[s.Type()]; ok { - // We have a Copier for this struct, so we use that copier to - // get the copy, and we ignore anything deeper than this. - w.ignoreDepth = w.depth - - dup, err := c(s.Interface()) - if err != nil { - return err - } - - // We need to put a pointer to the value on the value stack, - // so allocate a new pointer and set it. - v = reflect.New(s.Type()) - reflect.Indirect(v).Set(reflect.ValueOf(dup)) - } else { - // No copier, we copy ourselves and allow reflectwalk to guide - // us deeper into the structure for copying. - v = reflect.New(s.Type()) - } - - // Push the value onto the value stack for setting the struct field, - // and add the struct itself to the containers stack in case we walk - // deeper so that its own fields can be modified. - w.valPush(v) - w.cs = append(w.cs, v) - - return nil -} - -func (w *walker) StructField(f reflect.StructField, v reflect.Value) error { - if w.ignoring() { - return nil - } - - // If PkgPath is non-empty, this is a private (unexported) field. - // We do not set this unexported since the Go runtime doesn't allow us. - if f.PkgPath != "" { - return reflectwalk.SkipEntry - } - - switch f.Tag.Get(tagKey) { - case "shallow": - // If we're shallow copying then assign the value directly to the - // struct and skip the entry. - if v.IsValid() { - s := w.cs[len(w.cs)-1] - sf := reflect.Indirect(s).FieldByName(f.Name) - if sf.CanSet() { - sf.Set(v) - } - } - - return reflectwalk.SkipEntry - - case "ignore": - // Do nothing - return reflectwalk.SkipEntry - } - - // Push the field onto the stack, we'll handle it when we exit - // the struct field in Exit... - w.valPush(reflect.ValueOf(f)) - - return nil -} - -// ignore causes the walker to ignore any more values until we exit this on -func (w *walker) ignore() { - w.ignoreDepth = w.depth -} - -func (w *walker) ignoring() bool { - return w.ignoreDepth > 0 && w.depth >= w.ignoreDepth -} - -func (w *walker) pointerPeek() bool { - return w.ps[w.depth] > 0 -} - -func (w *walker) valPop() reflect.Value { - result := w.vals[len(w.vals)-1] - w.vals = w.vals[:len(w.vals)-1] - - // If we're out of values, that means we popped everything off. In - // this case, we reset the result so the next pushed value becomes - // the result. - if len(w.vals) == 0 { - w.Result = nil - } - - return result -} - -func (w *walker) valPush(v reflect.Value) { - w.vals = append(w.vals, v) - - // If we haven't set the result yet, then this is the result since - // it is the first (outermost) value we're seeing. - if w.Result == nil && v.IsValid() { - w.Result = v.Interface() - } -} - -func (w *walker) replacePointerMaybe() { - // Determine the last pointer value. If it is NOT a pointer, then - // we need to push that onto the stack. - if !w.pointerPeek() { - w.valPush(reflect.Indirect(w.valPop())) - return - } - - v := w.valPop() - - // If the expected type is a pointer to an interface of any depth, - // such as *interface{}, **interface{}, etc., then we need to convert - // the value "v" from *CONCRETE to *interface{} so types match for - // Set. - // - // Example if v is type *Foo where Foo is a struct, v would become - // *interface{} instead. This only happens if we have an interface expectation - // at this depth. - // - // For more info, see GH-16 - if iType, ok := w.ifaceTypes[ifaceKey(w.ps[w.depth], w.depth)]; ok && iType.Kind() == reflect.Interface { - y := reflect.New(iType) // Create *interface{} - y.Elem().Set(reflect.Indirect(v)) // Assign "Foo" to interface{} (dereferenced) - v = y // v is now typed *interface{} (where *v = Foo) - } - - for i := 1; i < w.ps[w.depth]; i++ { - if iType, ok := w.ifaceTypes[ifaceKey(w.ps[w.depth]-i, w.depth)]; ok { - iface := reflect.New(iType).Elem() - iface.Set(v) - v = iface - } - - p := reflect.New(v.Type()) - p.Elem().Set(v) - v = p - } - - w.valPush(v) -} - -// if this value is a Locker, lock it and add it to the locks slice -func (w *walker) lock(v reflect.Value) { - if !w.useLocks { - return - } - - if !v.IsValid() || !v.CanInterface() { - return - } - - type rlocker interface { - RLocker() sync.Locker - } - - var locker sync.Locker - - // We can't call Interface() on a value directly, since that requires - // a copy. This is OK, since the pointer to a value which is a sync.Locker - // is also a sync.Locker. - if v.Kind() == reflect.Ptr { - switch l := v.Interface().(type) { - case rlocker: - // don't lock a mutex directly - if _, ok := l.(*sync.RWMutex); !ok { - locker = l.RLocker() - } - case sync.Locker: - locker = l - } - } else if v.CanAddr() { - switch l := v.Addr().Interface().(type) { - case rlocker: - // don't lock a mutex directly - if _, ok := l.(*sync.RWMutex); !ok { - locker = l.RLocker() - } - case sync.Locker: - locker = l - } - } - - // still no callable locker - if locker == nil { - return - } - - // don't lock a mutex directly - switch locker.(type) { - case *sync.Mutex, *sync.RWMutex: - return - } - - locker.Lock() - w.locks[w.depth] = locker -} - -// wrapPtr is a helper that takes v and always make it *v. copystructure -// stores things internally as pointers until the last moment before unwrapping -func wrapPtr(v reflect.Value) reflect.Value { - if !v.IsValid() { - return v - } - vPtr := reflect.New(v.Type()) - vPtr.Elem().Set(v) - return vPtr -} diff --git a/vendor/github.com/mitchellh/reflectwalk/.travis.yml b/vendor/github.com/mitchellh/reflectwalk/.travis.yml deleted file mode 100644 index 4f2ee4d973..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: go diff --git a/vendor/github.com/mitchellh/reflectwalk/LICENSE b/vendor/github.com/mitchellh/reflectwalk/LICENSE deleted file mode 100644 index f9c841a51e..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/reflectwalk/README.md b/vendor/github.com/mitchellh/reflectwalk/README.md deleted file mode 100644 index ac82cd2e15..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# reflectwalk - -reflectwalk is a Go library for "walking" a value in Go using reflection, -in the same way a directory tree can be "walked" on the filesystem. Walking -a complex structure can allow you to do manipulations on unknown structures -such as those decoded from JSON. diff --git a/vendor/github.com/mitchellh/reflectwalk/location.go b/vendor/github.com/mitchellh/reflectwalk/location.go deleted file mode 100644 index 6a7f176117..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/location.go +++ /dev/null @@ -1,19 +0,0 @@ -package reflectwalk - -//go:generate stringer -type=Location location.go - -type Location uint - -const ( - None Location = iota - Map - MapKey - MapValue - Slice - SliceElem - Array - ArrayElem - Struct - StructField - WalkLoc -) diff --git a/vendor/github.com/mitchellh/reflectwalk/location_string.go b/vendor/github.com/mitchellh/reflectwalk/location_string.go deleted file mode 100644 index 70760cf4c7..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/location_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by "stringer -type=Location location.go"; DO NOT EDIT. - -package reflectwalk - -import "fmt" - -const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemArrayArrayElemStructStructFieldWalkLoc" - -var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 40, 49, 55, 66, 73} - -func (i Location) String() string { - if i >= Location(len(_Location_index)-1) { - return fmt.Sprintf("Location(%d)", i) - } - return _Location_name[_Location_index[i]:_Location_index[i+1]] -} diff --git a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go b/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go deleted file mode 100644 index 7fee7b050b..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go +++ /dev/null @@ -1,420 +0,0 @@ -// reflectwalk is a package that allows you to "walk" complex structures -// similar to how you may "walk" a filesystem: visiting every element one -// by one and calling callback functions allowing you to handle and manipulate -// those elements. -package reflectwalk - -import ( - "errors" - "reflect" -) - -// PrimitiveWalker implementations are able to handle primitive values -// within complex structures. Primitive values are numbers, strings, -// booleans, funcs, chans. -// -// These primitive values are often members of more complex -// structures (slices, maps, etc.) that are walkable by other interfaces. -type PrimitiveWalker interface { - Primitive(reflect.Value) error -} - -// InterfaceWalker implementations are able to handle interface values as they -// are encountered during the walk. -type InterfaceWalker interface { - Interface(reflect.Value) error -} - -// MapWalker implementations are able to handle individual elements -// found within a map structure. -type MapWalker interface { - Map(m reflect.Value) error - MapElem(m, k, v reflect.Value) error -} - -// SliceWalker implementations are able to handle slice elements found -// within complex structures. -type SliceWalker interface { - Slice(reflect.Value) error - SliceElem(int, reflect.Value) error -} - -// ArrayWalker implementations are able to handle array elements found -// within complex structures. -type ArrayWalker interface { - Array(reflect.Value) error - ArrayElem(int, reflect.Value) error -} - -// StructWalker is an interface that has methods that are called for -// structs when a Walk is done. -type StructWalker interface { - Struct(reflect.Value) error - StructField(reflect.StructField, reflect.Value) error -} - -// EnterExitWalker implementations are notified before and after -// they walk deeper into complex structures (into struct fields, -// into slice elements, etc.) -type EnterExitWalker interface { - Enter(Location) error - Exit(Location) error -} - -// PointerWalker implementations are notified when the value they're -// walking is a pointer or not. Pointer is called for _every_ value whether -// it is a pointer or not. -type PointerWalker interface { - PointerEnter(bool) error - PointerExit(bool) error -} - -// PointerValueWalker implementations are notified with the value of -// a particular pointer when a pointer is walked. Pointer is called -// right before PointerEnter. -type PointerValueWalker interface { - Pointer(reflect.Value) error -} - -// SkipEntry can be returned from walk functions to skip walking -// the value of this field. This is only valid in the following functions: -// -// - Struct: skips all fields from being walked -// - StructField: skips walking the struct value -// -var SkipEntry = errors.New("skip this entry") - -// Walk takes an arbitrary value and an interface and traverses the -// value, calling callbacks on the interface if they are supported. -// The interface should implement one or more of the walker interfaces -// in this package, such as PrimitiveWalker, StructWalker, etc. -func Walk(data, walker interface{}) (err error) { - v := reflect.ValueOf(data) - ew, ok := walker.(EnterExitWalker) - if ok { - err = ew.Enter(WalkLoc) - } - - if err == nil { - err = walk(v, walker) - } - - if ok && err == nil { - err = ew.Exit(WalkLoc) - } - - return -} - -func walk(v reflect.Value, w interface{}) (err error) { - // Determine if we're receiving a pointer and if so notify the walker. - // The logic here is convoluted but very important (tests will fail if - // almost any part is changed). I will try to explain here. - // - // First, we check if the value is an interface, if so, we really need - // to check the interface's VALUE to see whether it is a pointer. - // - // Check whether the value is then a pointer. If so, then set pointer - // to true to notify the user. - // - // If we still have a pointer or an interface after the indirections, then - // we unwrap another level - // - // At this time, we also set "v" to be the dereferenced value. This is - // because once we've unwrapped the pointer we want to use that value. - pointer := false - pointerV := v - - for { - if pointerV.Kind() == reflect.Interface { - if iw, ok := w.(InterfaceWalker); ok { - if err = iw.Interface(pointerV); err != nil { - return - } - } - - pointerV = pointerV.Elem() - } - - if pointerV.Kind() == reflect.Ptr { - if pw, ok := w.(PointerValueWalker); ok { - if err = pw.Pointer(pointerV); err != nil { - if err == SkipEntry { - // Skip the rest of this entry but clear the error - return nil - } - - return - } - } - - pointer = true - v = reflect.Indirect(pointerV) - } - if pw, ok := w.(PointerWalker); ok { - if err = pw.PointerEnter(pointer); err != nil { - return - } - - defer func(pointer bool) { - if err != nil { - return - } - - err = pw.PointerExit(pointer) - }(pointer) - } - - if pointer { - pointerV = v - } - pointer = false - - // If we still have a pointer or interface we have to indirect another level. - switch pointerV.Kind() { - case reflect.Ptr, reflect.Interface: - continue - } - break - } - - // We preserve the original value here because if it is an interface - // type, we want to pass that directly into the walkPrimitive, so that - // we can set it. - originalV := v - if v.Kind() == reflect.Interface { - v = v.Elem() - } - - k := v.Kind() - if k >= reflect.Int && k <= reflect.Complex128 { - k = reflect.Int - } - - switch k { - // Primitives - case reflect.Bool, reflect.Chan, reflect.Func, reflect.Int, reflect.String, reflect.Invalid: - err = walkPrimitive(originalV, w) - return - case reflect.Map: - err = walkMap(v, w) - return - case reflect.Slice: - err = walkSlice(v, w) - return - case reflect.Struct: - err = walkStruct(v, w) - return - case reflect.Array: - err = walkArray(v, w) - return - default: - panic("unsupported type: " + k.String()) - } -} - -func walkMap(v reflect.Value, w interface{}) error { - ew, ewok := w.(EnterExitWalker) - if ewok { - ew.Enter(Map) - } - - if mw, ok := w.(MapWalker); ok { - if err := mw.Map(v); err != nil { - return err - } - } - - for _, k := range v.MapKeys() { - kv := v.MapIndex(k) - - if mw, ok := w.(MapWalker); ok { - if err := mw.MapElem(v, k, kv); err != nil { - return err - } - } - - ew, ok := w.(EnterExitWalker) - if ok { - ew.Enter(MapKey) - } - - if err := walk(k, w); err != nil { - return err - } - - if ok { - ew.Exit(MapKey) - ew.Enter(MapValue) - } - - // get the map value again as it may have changed in the MapElem call - if err := walk(v.MapIndex(k), w); err != nil { - return err - } - - if ok { - ew.Exit(MapValue) - } - } - - if ewok { - ew.Exit(Map) - } - - return nil -} - -func walkPrimitive(v reflect.Value, w interface{}) error { - if pw, ok := w.(PrimitiveWalker); ok { - return pw.Primitive(v) - } - - return nil -} - -func walkSlice(v reflect.Value, w interface{}) (err error) { - ew, ok := w.(EnterExitWalker) - if ok { - ew.Enter(Slice) - } - - if sw, ok := w.(SliceWalker); ok { - if err := sw.Slice(v); err != nil { - return err - } - } - - for i := 0; i < v.Len(); i++ { - elem := v.Index(i) - - if sw, ok := w.(SliceWalker); ok { - if err := sw.SliceElem(i, elem); err != nil { - return err - } - } - - ew, ok := w.(EnterExitWalker) - if ok { - ew.Enter(SliceElem) - } - - if err := walk(elem, w); err != nil { - return err - } - - if ok { - ew.Exit(SliceElem) - } - } - - ew, ok = w.(EnterExitWalker) - if ok { - ew.Exit(Slice) - } - - return nil -} - -func walkArray(v reflect.Value, w interface{}) (err error) { - ew, ok := w.(EnterExitWalker) - if ok { - ew.Enter(Array) - } - - if aw, ok := w.(ArrayWalker); ok { - if err := aw.Array(v); err != nil { - return err - } - } - - for i := 0; i < v.Len(); i++ { - elem := v.Index(i) - - if aw, ok := w.(ArrayWalker); ok { - if err := aw.ArrayElem(i, elem); err != nil { - return err - } - } - - ew, ok := w.(EnterExitWalker) - if ok { - ew.Enter(ArrayElem) - } - - if err := walk(elem, w); err != nil { - return err - } - - if ok { - ew.Exit(ArrayElem) - } - } - - ew, ok = w.(EnterExitWalker) - if ok { - ew.Exit(Array) - } - - return nil -} - -func walkStruct(v reflect.Value, w interface{}) (err error) { - ew, ewok := w.(EnterExitWalker) - if ewok { - ew.Enter(Struct) - } - - skip := false - if sw, ok := w.(StructWalker); ok { - err = sw.Struct(v) - if err == SkipEntry { - skip = true - err = nil - } - if err != nil { - return - } - } - - if !skip { - vt := v.Type() - for i := 0; i < vt.NumField(); i++ { - sf := vt.Field(i) - f := v.FieldByIndex([]int{i}) - - if sw, ok := w.(StructWalker); ok { - err = sw.StructField(sf, f) - - // SkipEntry just pretends this field doesn't even exist - if err == SkipEntry { - continue - } - - if err != nil { - return - } - } - - ew, ok := w.(EnterExitWalker) - if ok { - ew.Enter(StructField) - } - - err = walk(f, w) - if err != nil { - return - } - - if ok { - ew.Exit(StructField) - } - } - } - - if ewok { - ew.Exit(Struct) - } - - return nil -} diff --git a/vendor/github.com/rancher/go-rancher/api/api.go b/vendor/github.com/rancher/go-rancher/api/api.go index aa37be181e..267aee1af4 100644 --- a/vendor/github.com/rancher/go-rancher/api/api.go +++ b/vendor/github.com/rancher/go-rancher/api/api.go @@ -6,7 +6,7 @@ import ( "reflect" "github.com/rancher/go-rancher/client" - "github.com/sirupsen/logrus" + v2client "github.com/rancher/go-rancher/v2" ) func toMap(obj interface{}) (map[string]interface{}, error) { @@ -43,28 +43,46 @@ func getEmbedded(obj interface{}, checkType reflect.Type) interface{} { return nil } -func getCollection(obj interface{}) *client.Collection { +func getCollection(obj interface{}) interface{} { val := getEmbedded(obj, reflect.TypeOf(client.Collection{})) if val == nil { - return nil + val = getEmbedded(obj, reflect.TypeOf(v2client.Collection{})) + if val == nil { + return nil + } } - return val.(*client.Collection) + return val } -func getResource(obj interface{}) *client.Resource { +func getResource(obj interface{}) (*client.Resource, *v2client.Resource) { r, ok := obj.(*client.Resource) if ok { - return r + return r, nil } rObj, ok := obj.(client.Resource) if ok { - return &rObj + return &rObj, nil + } + v2r, ok := obj.(*v2client.Resource) + if ok { + return nil, v2r + } + v2rObj, ok := obj.(v2client.Resource) + if ok { + return nil, &v2rObj } val := getEmbedded(obj, reflect.TypeOf(client.Resource{})) if val == nil { - return nil + val = getEmbedded(obj, reflect.TypeOf(v2client.Resource{})) + if val == nil { + return nil, nil + } } - return val.(*client.Resource) + v1Resource, ok := val.(*client.Resource) + if ok { + return v1Resource, nil + } + return nil, val.(*v2client.Resource) } func CollectionToMap(obj interface{}, schemas *client.Schemas) (map[string]interface{}, []map[string]interface{}, error) { @@ -108,27 +126,29 @@ func CollectionToMap(obj interface{}, schemas *client.Schemas) (map[string]inter } func ResourceToMap(obj interface{}, schemas *client.Schemas) (map[string]interface{}, error) { + var resourceType string result := map[string]interface{}{} if obj == nil { return result, nil } - resource := getResource(obj) - if resource == nil { + v1resource, v2resource := getResource(obj) + if v1resource == nil && v2resource == nil { return result, errors.New("value is not a Resource") } + if v1resource != nil { + resourceType = v1resource.Type + } else { + resourceType = v2resource.Type + } + objMap, err := toMap(obj) if err != nil { return result, err } - schema, ok := schemas.CheckSchema(resource.Type) - if !ok { - logrus.Errorf("Attempting to Write an unknown type: %s", resource.Type) - return result, nil - } - + schema := schemas.Schema(resourceType) for k, v := range objMap { _, ok := schema.CheckField(k) if !ok { diff --git a/vendor/github.com/rancher/go-rancher/api/handler.go b/vendor/github.com/rancher/go-rancher/api/handler.go index d71fd4f889..cc048ec2e8 100644 --- a/vendor/github.com/rancher/go-rancher/api/handler.go +++ b/vendor/github.com/rancher/go-rancher/api/handler.go @@ -3,19 +3,12 @@ package api import ( "net/http" + "github.com/Sirupsen/logrus" "github.com/gorilla/context" "github.com/gorilla/mux" - "github.com/mitchellh/copystructure" "github.com/rancher/go-rancher/client" - "github.com/sirupsen/logrus" ) -func ApiHandlerFunc(schemas *client.Schemas, f http.HandlerFunc) http.HandlerFunc { - return func(rw http.ResponseWriter, r *http.Request) { - ApiHandler(schemas, f).ServeHTTP(rw, r) - } -} - func ApiHandler(schemas *client.Schemas, f http.Handler) http.Handler { return context.ClearHandler(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { if err := CreateApiContext(rw, r, schemas); err != nil { @@ -89,25 +82,11 @@ func VersionHandler(schemas *client.Schemas, version string) http.Handler { func SchemasHandler(schemas *client.Schemas) http.Handler { return ApiHandler(schemas, http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { apiContext := GetApiContext(r) - - copy, err := copystructure.Copy(schemas) - if err != nil { - logrus.WithField("err", err).Errorf("Failed to deep copy schemas") - rw.WriteHeader(500) - return - } - - schemasCopy, ok := copy.(*client.Schemas) - if !ok { - logrus.WithField("err", err).Errorf("Invalid deep copy schemas") - rw.WriteHeader(500) - return - } - + schemasCopy := *schemas for i := range schemasCopy.Data { populateSchema(apiContext, &schemasCopy.Data[i]) } - apiContext.Write(schemasCopy) + apiContext.Write(&schemasCopy) })) } @@ -122,22 +101,9 @@ func SchemaHandler(schemas *client.Schemas) http.Handler { apiContext := GetApiContext(r) schema := schemas.Schema(mux.Vars(r)["id"]) - copy, err := copystructure.Copy(schema) - if err != nil { - logrus.WithField("err", err).Errorf("Failed to deep copy schema") - rw.WriteHeader(500) - return - } - - schemaCopy, ok := copy.(client.Schema) - if !ok { - logrus.WithField("err", err).Errorf("Invalid deep copy schema") - rw.WriteHeader(500) - return - } - populateSchema(apiContext, &schemaCopy) + populateSchema(apiContext, &schema) - apiContext.Write(&schemaCopy) + apiContext.Write(&schema) })) } diff --git a/vendor/github.com/rancher/go-rancher/api/reader.go b/vendor/github.com/rancher/go-rancher/api/reader.go deleted file mode 100644 index 92e720f525..0000000000 --- a/vendor/github.com/rancher/go-rancher/api/reader.go +++ /dev/null @@ -1,8 +0,0 @@ -package api - -import "encoding/json" - -func (a *ApiContext) Read(obj interface{}) error { - decoder := json.NewDecoder(a.r.Body) - return decoder.Decode(obj) -} diff --git a/vendor/github.com/rancher/go-rancher/api/url.go b/vendor/github.com/rancher/go-rancher/api/url.go index d25f94bfc4..0e43289e8a 100644 --- a/vendor/github.com/rancher/go-rancher/api/url.go +++ b/vendor/github.com/rancher/go-rancher/api/url.go @@ -32,7 +32,7 @@ var ( ) type UrlBuilder interface { - ActionLink(resource client.Resource, name string) string + //ActionLink(resource client.Resource, name string) string Current() string Collection(resourceType string) string Link(resource client.Resource, name string) string @@ -93,10 +93,6 @@ func (u *urlBuilder) ReferenceByIdLink(resourceType string, id string) string { return u.constructBasicUrl(u.getPluralName(resourceType), id) } -func (u *urlBuilder) ActionLink(resource client.Resource, action string) string { - return u.constructBasicUrl(u.getPluralName(resource.Type), resource.Id) + "?action=" + action -} - func (u *urlBuilder) Version(version string) string { return fmt.Sprintf("%s/%s", u.responseUrlBase, version) } diff --git a/vendor/github.com/rancher/go-rancher/api/writer.go b/vendor/github.com/rancher/go-rancher/api/writer.go index c25ec9e0fb..67049a1a8b 100644 --- a/vendor/github.com/rancher/go-rancher/api/writer.go +++ b/vendor/github.com/rancher/go-rancher/api/writer.go @@ -5,30 +5,13 @@ import ( "net/http" "reflect" - "github.com/rancher/go-rancher/client" - "github.com/sirupsen/logrus" + "github.com/Sirupsen/logrus" ) type ApiResponseWriter interface { Write(obj interface{}, rw http.ResponseWriter) error } -func (a *ApiContext) WriteErr(err error) { - logrus.Errorf("Error in request: %v", err) - a.responseWriter.WriteHeader(500) - writeErr := a.WriteResource(&client.ServerApiError{ - Resource: client.Resource{ - Type: "error", - }, - Status: 500, - Code: "Server Error", - Message: err.Error(), - }) - if writeErr != nil { - logrus.Errorf("Failed to write err: %v", err) - } -} - func (a *ApiContext) Write(obj interface{}) { var err error collection := getCollection(obj) @@ -40,7 +23,7 @@ func (a *ApiContext) Write(obj interface{}) { if err != nil { logrus.WithField("err", err).Errorf("Failed to write response") - a.WriteErr(err) + a.responseWriter.WriteHeader(500) } } @@ -61,24 +44,17 @@ func setIfNot(data map[string]interface{}, key string, value interface{}) map[st } func (a *ApiContext) WriteCollection(obj interface{}) error { - collectionData, err := a.PopulateCollection(obj) - if err != nil { - return err - } - return a.apiResponseWriter.Write(collectionData, a.responseWriter) -} - -func (a *ApiContext) PopulateCollection(obj interface{}) (map[string]interface{}, error) { collectionData, resourcesData, err := CollectionToMap(obj, a.schemas) if err != nil { - return nil, err + return err } a.populateCollection(collectionData, resourcesData) for _, resource := range resourcesData { a.populateResource(resource) } - return collectionData, nil + + return a.apiResponseWriter.Write(collectionData, a.responseWriter) } func (a *ApiContext) WriteResource(obj interface{}) error { @@ -104,7 +80,7 @@ func mapInterfaceToString(input interface{}) map[string]string { result[k] = fmt.Sprintf("%s", v) } default: - logrus.Infof("Unknown type %v", reflect.TypeOf(input)) + logrus.Infof("Unknown type: %v", reflect.TypeOf(input)) } return result } diff --git a/vendor/github.com/rancher/go-rancher/client/types.go b/vendor/github.com/rancher/go-rancher/client/types.go index 828ff79f9b..905df87ffa 100644 --- a/vendor/github.com/rancher/go-rancher/client/types.go +++ b/vendor/github.com/rancher/go-rancher/client/types.go @@ -93,11 +93,3 @@ type Filter struct { type ListOpts struct { Filters map[string]interface{} } - -type ServerApiError struct { - Resource - Status int `json:"status"` - Code string `json:"code"` - Message string `json:"message"` - Detail string `json:"detail"` -} diff --git a/vendor/github.com/rancher/go-rancher/v2/client.go b/vendor/github.com/rancher/go-rancher/v2/client.go new file mode 100644 index 0000000000..fef9e40fa6 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/client.go @@ -0,0 +1,39 @@ +package client + +import ( + "net/http" + + "github.com/gorilla/websocket" +) + +type RancherBaseClientImpl struct { + Opts *ClientOpts + Schemas *Schemas + Types map[string]Schema +} + +type RancherBaseClient interface { + Websocket(string, map[string][]string) (*websocket.Conn, *http.Response, error) + List(string, *ListOpts, interface{}) error + Post(string, interface{}, interface{}) error + GetLink(Resource, string, interface{}) error + Create(string, interface{}, interface{}) error + Update(string, *Resource, interface{}, interface{}) error + ById(string, string, interface{}) error + Delete(*Resource) error + Reload(*Resource, interface{}) error + Action(string, string, *Resource, interface{}, interface{}) error + GetOpts() *ClientOpts + GetSchemas() *Schemas + GetTypes() map[string]Schema + + doGet(string, *ListOpts, interface{}) error + doList(string, *ListOpts, interface{}) error + doNext(string, interface{}) error + doModify(string, string, interface{}, interface{}) error + doCreate(string, interface{}, interface{}) error + doUpdate(string, *Resource, interface{}, interface{}) error + doById(string, string, interface{}) error + doResourceDelete(string, *Resource) error + doAction(string, string, *Resource, interface{}, interface{}) error +} diff --git a/vendor/github.com/rancher/go-rancher/v2/common.go b/vendor/github.com/rancher/go-rancher/v2/common.go new file mode 100644 index 0000000000..129e15153c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/common.go @@ -0,0 +1,629 @@ +package client + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "regexp" + "strconv" + "strings" + "time" + + "github.com/gorilla/websocket" + "github.com/pkg/errors" +) + +const ( + SELF = "self" + COLLECTION = "collection" +) + +var ( + debug = false + dialer = &websocket.Dialer{} + privateFieldRegex = regexp.MustCompile("^[[:lower:]]") +) + +type ClientOpts struct { + Url string + AccessKey string + SecretKey string + Timeout time.Duration +} + +type ApiError struct { + StatusCode int + Url string + Msg string + Status string + Body string +} + +func (e *ApiError) Error() string { + return e.Msg +} + +func IsNotFound(err error) bool { + apiError, ok := err.(*ApiError) + if !ok { + return false + } + + return apiError.StatusCode == http.StatusNotFound +} + +func newApiError(resp *http.Response, url string) *ApiError { + contents, err := ioutil.ReadAll(resp.Body) + var body string + if err != nil { + body = "Unreadable body." + } else { + body = string(contents) + } + + data := map[string]interface{}{} + if json.Unmarshal(contents, &data) == nil { + delete(data, "id") + delete(data, "links") + delete(data, "actions") + delete(data, "type") + delete(data, "status") + buf := &bytes.Buffer{} + for k, v := range data { + if v == nil { + continue + } + if buf.Len() > 0 { + buf.WriteString(", ") + } + fmt.Fprintf(buf, "%s=%v", k, v) + } + body = buf.String() + } + formattedMsg := fmt.Sprintf("Bad response statusCode [%d]. Status [%s]. Body: [%s] from [%s]", + resp.StatusCode, resp.Status, body, url) + return &ApiError{ + Url: url, + Msg: formattedMsg, + StatusCode: resp.StatusCode, + Status: resp.Status, + Body: body, + } +} + +func contains(array []string, item string) bool { + for _, check := range array { + if check == item { + return true + } + } + + return false +} + +func appendFilters(urlString string, filters map[string]interface{}) (string, error) { + if len(filters) == 0 { + return urlString, nil + } + + u, err := url.Parse(urlString) + if err != nil { + return "", err + } + + q := u.Query() + for k, v := range filters { + if l, ok := v.([]string); ok { + for _, v := range l { + q.Add(k, v) + } + } else { + q.Add(k, fmt.Sprintf("%v", v)) + } + } + + u.RawQuery = q.Encode() + return u.String(), nil +} + +func NormalizeUrl(existingUrl string) (string, error) { + u, err := url.Parse(existingUrl) + if err != nil { + return "", err + } + + if u.Path == "" || u.Path == "/" { + u.Path = "v2-beta" + } else if u.Path == "/v1" || strings.HasPrefix(u.Path, "/v1/") { + u.Path = strings.Replace(u.Path, "/v1", "/v2-beta", 1) + } + + return u.String(), nil +} + +func setupRancherBaseClient(rancherClient *RancherBaseClientImpl, opts *ClientOpts) error { + var err error + opts.Url, err = NormalizeUrl(opts.Url) + if err != nil { + return err + } + + if opts.Timeout == 0 { + opts.Timeout = time.Second * time.Duration(defaultTimeout()) + } + client := &http.Client{Timeout: opts.Timeout} + req, err := http.NewRequest("GET", opts.Url, nil) + if err != nil { + return err + } + + req.SetBasicAuth(opts.AccessKey, opts.SecretKey) + + resp, err := client.Do(req) + if err != nil { + return err + } + + defer resp.Body.Close() + + if resp.StatusCode != 200 { + return newApiError(resp, opts.Url) + } + + schemasUrls := resp.Header.Get("X-API-Schemas") + if len(schemasUrls) == 0 { + return errors.New("Failed to find schema at [" + opts.Url + "]") + } + + if schemasUrls != opts.Url { + req, err = http.NewRequest("GET", schemasUrls, nil) + req.SetBasicAuth(opts.AccessKey, opts.SecretKey) + if err != nil { + return err + } + + resp, err = client.Do(req) + if err != nil { + return err + } + + defer resp.Body.Close() + + if resp.StatusCode != 200 { + return newApiError(resp, opts.Url) + } + } + + var schemas Schemas + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + err = json.Unmarshal(bytes, &schemas) + if err != nil { + return err + } + + rancherClient.Opts = opts + rancherClient.Schemas = &schemas + + for _, schema := range schemas.Data { + rancherClient.Types[schema.Id] = schema + } + + return nil +} + +func NewListOpts() *ListOpts { + return &ListOpts{ + Filters: map[string]interface{}{}, + } +} + +func (rancherClient *RancherBaseClientImpl) setupRequest(req *http.Request) { + req.SetBasicAuth(rancherClient.Opts.AccessKey, rancherClient.Opts.SecretKey) +} + +func (rancherClient *RancherBaseClientImpl) newHttpClient() *http.Client { + if rancherClient.Opts.Timeout == 0 { + rancherClient.Opts.Timeout = time.Second * time.Duration(defaultTimeout()) + } + return &http.Client{Timeout: rancherClient.Opts.Timeout} +} + +func (rancherClient *RancherBaseClientImpl) doDelete(url string) error { + client := rancherClient.newHttpClient() + req, err := http.NewRequest("DELETE", url, nil) + if err != nil { + return err + } + + rancherClient.setupRequest(req) + + resp, err := client.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + io.Copy(ioutil.Discard, resp.Body) + + if resp.StatusCode >= 300 { + return newApiError(resp, url) + } + + return nil +} + +func (rancherClient *RancherBaseClientImpl) Websocket(url string, headers map[string][]string) (*websocket.Conn, *http.Response, error) { + httpHeaders := http.Header{} + for k, v := range httpHeaders { + httpHeaders[k] = v + } + + if rancherClient.Opts != nil { + s := rancherClient.Opts.AccessKey + ":" + rancherClient.Opts.SecretKey + httpHeaders.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(s))) + } + + return dialer.Dial(url, http.Header(httpHeaders)) +} + +func (rancherClient *RancherBaseClientImpl) doGet(url string, opts *ListOpts, respObject interface{}) error { + if opts == nil { + opts = NewListOpts() + } + url, err := appendFilters(url, opts.Filters) + if err != nil { + return err + } + + if debug { + fmt.Println("GET " + url) + } + + client := rancherClient.newHttpClient() + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return err + } + + rancherClient.setupRequest(req) + + resp, err := client.Do(req) + if err != nil { + return err + } + + defer resp.Body.Close() + + if resp.StatusCode != 200 { + return newApiError(resp, url) + } + + byteContent, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + if debug { + fmt.Println("Response <= " + string(byteContent)) + } + + if err := json.Unmarshal(byteContent, respObject); err != nil { + return errors.Wrap(err, fmt.Sprintf("Failed to parse: %s", byteContent)) + } + + return nil +} + +func (rancherClient *RancherBaseClientImpl) List(schemaType string, opts *ListOpts, respObject interface{}) error { + return rancherClient.doList(schemaType, opts, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doList(schemaType string, opts *ListOpts, respObject interface{}) error { + schema, ok := rancherClient.Types[schemaType] + if !ok { + return errors.New("Unknown schema type [" + schemaType + "]") + } + + if !contains(schema.CollectionMethods, "GET") { + return errors.New("Resource type [" + schemaType + "] is not listable") + } + + collectionUrl, ok := schema.Links[COLLECTION] + if !ok { + return errors.New("Failed to find collection URL for [" + schemaType + "]") + } + + return rancherClient.doGet(collectionUrl, opts, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doNext(nextUrl string, respObject interface{}) error { + return rancherClient.doGet(nextUrl, nil, respObject) +} + +func (rancherClient *RancherBaseClientImpl) Post(url string, createObj interface{}, respObject interface{}) error { + return rancherClient.doModify("POST", url, createObj, respObject) +} + +func (rancherClient *RancherBaseClientImpl) GetLink(resource Resource, link string, respObject interface{}) error { + url := resource.Links[link] + if url == "" { + return fmt.Errorf("Failed to find link: %s", link) + } + + return rancherClient.doGet(url, &ListOpts{}, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doModify(method string, url string, createObj interface{}, respObject interface{}) error { + bodyContent, err := json.Marshal(createObj) + if err != nil { + return err + } + + if debug { + fmt.Println(method + " " + url) + fmt.Println("Request => " + string(bodyContent)) + } + + client := rancherClient.newHttpClient() + req, err := http.NewRequest(method, url, bytes.NewBuffer(bodyContent)) + if err != nil { + return err + } + + rancherClient.setupRequest(req) + req.Header.Set("Content-Type", "application/json") + + resp, err := client.Do(req) + if err != nil { + return err + } + + defer resp.Body.Close() + + if resp.StatusCode >= 300 { + return newApiError(resp, url) + } + + byteContent, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + if len(byteContent) > 0 { + if debug { + fmt.Println("Response <= " + string(byteContent)) + } + return json.Unmarshal(byteContent, respObject) + } + + return nil +} + +func (rancherClient *RancherBaseClientImpl) Create(schemaType string, createObj interface{}, respObject interface{}) error { + return rancherClient.doCreate(schemaType, createObj, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doCreate(schemaType string, createObj interface{}, respObject interface{}) error { + if createObj == nil { + createObj = map[string]string{} + } + if respObject == nil { + respObject = &map[string]interface{}{} + } + schema, ok := rancherClient.Types[schemaType] + if !ok { + return errors.New("Unknown schema type [" + schemaType + "]") + } + + if !contains(schema.CollectionMethods, "POST") { + return errors.New("Resource type [" + schemaType + "] is not creatable") + } + + var collectionUrl string + collectionUrl, ok = schema.Links[COLLECTION] + if !ok { + // return errors.New("Failed to find collection URL for [" + schemaType + "]") + // This is a hack to address https://github.com/rancher/cattle/issues/254 + re := regexp.MustCompile("schemas.*") + collectionUrl = re.ReplaceAllString(schema.Links[SELF], schema.PluralName) + } + + return rancherClient.doModify("POST", collectionUrl, createObj, respObject) +} + +func (rancherClient *RancherBaseClientImpl) Update(schemaType string, existing *Resource, updates interface{}, respObject interface{}) error { + return rancherClient.doUpdate(schemaType, existing, updates, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doUpdate(schemaType string, existing *Resource, updates interface{}, respObject interface{}) error { + if existing == nil { + return errors.New("Existing object is nil") + } + + selfUrl, ok := existing.Links[SELF] + if !ok { + return errors.New(fmt.Sprintf("Failed to find self URL of [%v]", existing)) + } + + if updates == nil { + updates = map[string]string{} + } + + if respObject == nil { + respObject = &map[string]interface{}{} + } + + schema, ok := rancherClient.Types[schemaType] + if !ok { + return errors.New("Unknown schema type [" + schemaType + "]") + } + + if !contains(schema.ResourceMethods, "PUT") { + return errors.New("Resource type [" + schemaType + "] is not updatable") + } + + return rancherClient.doModify("PUT", selfUrl, updates, respObject) +} + +func (rancherClient *RancherBaseClientImpl) ById(schemaType string, id string, respObject interface{}) error { + return rancherClient.doById(schemaType, id, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doById(schemaType string, id string, respObject interface{}) error { + schema, ok := rancherClient.Types[schemaType] + if !ok { + return errors.New("Unknown schema type [" + schemaType + "]") + } + + if !contains(schema.ResourceMethods, "GET") { + return errors.New("Resource type [" + schemaType + "] can not be looked up by ID") + } + + collectionUrl, ok := schema.Links[COLLECTION] + if !ok { + return errors.New("Failed to find collection URL for [" + schemaType + "]") + } + + err := rancherClient.doGet(collectionUrl+"/"+id, nil, respObject) + //TODO check for 404 and return nil, nil + return err +} + +func (rancherClient *RancherBaseClientImpl) Delete(existing *Resource) error { + if existing == nil { + return nil + } + return rancherClient.doResourceDelete(existing.Type, existing) +} + +func (rancherClient *RancherBaseClientImpl) doResourceDelete(schemaType string, existing *Resource) error { + schema, ok := rancherClient.Types[schemaType] + if !ok { + return errors.New("Unknown schema type [" + schemaType + "]") + } + + if !contains(schema.ResourceMethods, "DELETE") { + return errors.New("Resource type [" + schemaType + "] can not be deleted") + } + + selfUrl, ok := existing.Links[SELF] + if !ok { + return errors.New(fmt.Sprintf("Failed to find self URL of [%v]", existing)) + } + + return rancherClient.doDelete(selfUrl) +} + +func (rancherClient *RancherBaseClientImpl) Reload(existing *Resource, output interface{}) error { + selfUrl, ok := existing.Links[SELF] + if !ok { + return errors.New(fmt.Sprintf("Failed to find self URL of [%v]", existing)) + } + + return rancherClient.doGet(selfUrl, NewListOpts(), output) +} + +func (rancherClient *RancherBaseClientImpl) Action(schemaType string, action string, + existing *Resource, inputObject, respObject interface{}) error { + return rancherClient.doAction(schemaType, action, existing, inputObject, respObject) +} + +func (rancherClient *RancherBaseClientImpl) doAction(schemaType string, action string, + existing *Resource, inputObject, respObject interface{}) error { + + if existing == nil { + return errors.New("Existing object is nil") + } + + actionUrl, ok := existing.Actions[action] + if !ok { + return errors.New(fmt.Sprintf("Action [%v] not available on [%v]", action, existing)) + } + + _, ok = rancherClient.Types[schemaType] + if !ok { + return errors.New("Unknown schema type [" + schemaType + "]") + } + + var input io.Reader + + if inputObject != nil { + bodyContent, err := json.Marshal(inputObject) + if err != nil { + return err + } + if debug { + fmt.Println("Request => " + string(bodyContent)) + } + input = bytes.NewBuffer(bodyContent) + } + + client := rancherClient.newHttpClient() + req, err := http.NewRequest("POST", actionUrl, input) + if err != nil { + return err + } + + rancherClient.setupRequest(req) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Content-Length", "0") + + resp, err := client.Do(req) + if err != nil { + return err + } + + defer resp.Body.Close() + + if resp.StatusCode >= 300 { + return newApiError(resp, actionUrl) + } + + byteContent, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + if debug { + fmt.Println("Response <= " + string(byteContent)) + } + + return json.Unmarshal(byteContent, respObject) +} + +func (rancherClient *RancherBaseClientImpl) GetOpts() *ClientOpts { + return rancherClient.Opts +} + +func (rancherClient *RancherBaseClientImpl) GetSchemas() *Schemas { + return rancherClient.Schemas +} + +func (rancherClient *RancherBaseClientImpl) GetTypes() map[string]Schema { + return rancherClient.Types +} + +func init() { + debug = os.Getenv("RANCHER_CLIENT_DEBUG") == "true" + if debug { + fmt.Println("Rancher client debug on") + } +} + +func defaultTimeout() int { + defaultTimeout, _ := strconv.Atoi(os.Getenv("RANCHER_CLIENT_TIMEOUT")) + if defaultTimeout == 0 { + defaultTimeout = 10 + } + return defaultTimeout +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_account.go b/vendor/github.com/rancher/go-rancher/v2/generated_account.go new file mode 100644 index 0000000000..c4b86be32c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_account.go @@ -0,0 +1,186 @@ +package client + +const ( + ACCOUNT_TYPE = "account" +) + +type Account struct { + Resource + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExternalIdType string `json:"externalIdType,omitempty" yaml:"external_id_type,omitempty"` + + Identity string `json:"identity,omitempty" yaml:"identity,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} + +type AccountCollection struct { + Collection + Data []Account `json:"data,omitempty"` + client *AccountClient +} + +type AccountClient struct { + rancherClient *RancherClient +} + +type AccountOperations interface { + List(opts *ListOpts) (*AccountCollection, error) + Create(opts *Account) (*Account, error) + Update(existing *Account, updates interface{}) (*Account, error) + ById(id string) (*Account, error) + Delete(container *Account) error + + ActionActivate(*Account) (*Account, error) + + ActionCreate(*Account) (*Account, error) + + ActionDeactivate(*Account) (*Account, error) + + ActionPurge(*Account) (*Account, error) + + ActionRemove(*Account) (*Account, error) + + ActionUpdate(*Account) (*Account, error) + + ActionUpgrade(*Account) (*Account, error) +} + +func newAccountClient(rancherClient *RancherClient) *AccountClient { + return &AccountClient{ + rancherClient: rancherClient, + } +} + +func (c *AccountClient) Create(container *Account) (*Account, error) { + resp := &Account{} + err := c.rancherClient.doCreate(ACCOUNT_TYPE, container, resp) + return resp, err +} + +func (c *AccountClient) Update(existing *Account, updates interface{}) (*Account, error) { + resp := &Account{} + err := c.rancherClient.doUpdate(ACCOUNT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AccountClient) List(opts *ListOpts) (*AccountCollection, error) { + resp := &AccountCollection{} + err := c.rancherClient.doList(ACCOUNT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AccountCollection) Next() (*AccountCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AccountCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AccountClient) ById(id string) (*Account, error) { + resp := &Account{} + err := c.rancherClient.doById(ACCOUNT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AccountClient) Delete(container *Account) error { + return c.rancherClient.doResourceDelete(ACCOUNT_TYPE, &container.Resource) +} + +func (c *AccountClient) ActionActivate(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AccountClient) ActionCreate(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AccountClient) ActionDeactivate(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AccountClient) ActionPurge(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AccountClient) ActionRemove(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AccountClient) ActionUpdate(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AccountClient) ActionUpgrade(resource *Account) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(ACCOUNT_TYPE, "upgrade", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_active_setting.go b/vendor/github.com/rancher/go-rancher/v2/generated_active_setting.go new file mode 100644 index 0000000000..b1799a31d4 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_active_setting.go @@ -0,0 +1,87 @@ +package client + +const ( + ACTIVE_SETTING_TYPE = "activeSetting" +) + +type ActiveSetting struct { + Resource + + ActiveValue interface{} `json:"activeValue,omitempty" yaml:"active_value,omitempty"` + + InDb bool `json:"inDb,omitempty" yaml:"in_db,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Source string `json:"source,omitempty" yaml:"source,omitempty"` + + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type ActiveSettingCollection struct { + Collection + Data []ActiveSetting `json:"data,omitempty"` + client *ActiveSettingClient +} + +type ActiveSettingClient struct { + rancherClient *RancherClient +} + +type ActiveSettingOperations interface { + List(opts *ListOpts) (*ActiveSettingCollection, error) + Create(opts *ActiveSetting) (*ActiveSetting, error) + Update(existing *ActiveSetting, updates interface{}) (*ActiveSetting, error) + ById(id string) (*ActiveSetting, error) + Delete(container *ActiveSetting) error +} + +func newActiveSettingClient(rancherClient *RancherClient) *ActiveSettingClient { + return &ActiveSettingClient{ + rancherClient: rancherClient, + } +} + +func (c *ActiveSettingClient) Create(container *ActiveSetting) (*ActiveSetting, error) { + resp := &ActiveSetting{} + err := c.rancherClient.doCreate(ACTIVE_SETTING_TYPE, container, resp) + return resp, err +} + +func (c *ActiveSettingClient) Update(existing *ActiveSetting, updates interface{}) (*ActiveSetting, error) { + resp := &ActiveSetting{} + err := c.rancherClient.doUpdate(ACTIVE_SETTING_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ActiveSettingClient) List(opts *ListOpts) (*ActiveSettingCollection, error) { + resp := &ActiveSettingCollection{} + err := c.rancherClient.doList(ACTIVE_SETTING_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ActiveSettingCollection) Next() (*ActiveSettingCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ActiveSettingCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ActiveSettingClient) ById(id string) (*ActiveSetting, error) { + resp := &ActiveSetting{} + err := c.rancherClient.doById(ACTIVE_SETTING_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ActiveSettingClient) Delete(container *ActiveSetting) error { + return c.rancherClient.doResourceDelete(ACTIVE_SETTING_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_add_outputs_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_add_outputs_input.go new file mode 100644 index 0000000000..88bf4a7eb3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_add_outputs_input.go @@ -0,0 +1,79 @@ +package client + +const ( + ADD_OUTPUTS_INPUT_TYPE = "addOutputsInput" +) + +type AddOutputsInput struct { + Resource + + Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"` +} + +type AddOutputsInputCollection struct { + Collection + Data []AddOutputsInput `json:"data,omitempty"` + client *AddOutputsInputClient +} + +type AddOutputsInputClient struct { + rancherClient *RancherClient +} + +type AddOutputsInputOperations interface { + List(opts *ListOpts) (*AddOutputsInputCollection, error) + Create(opts *AddOutputsInput) (*AddOutputsInput, error) + Update(existing *AddOutputsInput, updates interface{}) (*AddOutputsInput, error) + ById(id string) (*AddOutputsInput, error) + Delete(container *AddOutputsInput) error +} + +func newAddOutputsInputClient(rancherClient *RancherClient) *AddOutputsInputClient { + return &AddOutputsInputClient{ + rancherClient: rancherClient, + } +} + +func (c *AddOutputsInputClient) Create(container *AddOutputsInput) (*AddOutputsInput, error) { + resp := &AddOutputsInput{} + err := c.rancherClient.doCreate(ADD_OUTPUTS_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *AddOutputsInputClient) Update(existing *AddOutputsInput, updates interface{}) (*AddOutputsInput, error) { + resp := &AddOutputsInput{} + err := c.rancherClient.doUpdate(ADD_OUTPUTS_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AddOutputsInputClient) List(opts *ListOpts) (*AddOutputsInputCollection, error) { + resp := &AddOutputsInputCollection{} + err := c.rancherClient.doList(ADD_OUTPUTS_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AddOutputsInputCollection) Next() (*AddOutputsInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AddOutputsInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AddOutputsInputClient) ById(id string) (*AddOutputsInput, error) { + resp := &AddOutputsInput{} + err := c.rancherClient.doById(ADD_OUTPUTS_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AddOutputsInputClient) Delete(container *AddOutputsInput) error { + return c.rancherClient.doResourceDelete(ADD_OUTPUTS_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_add_remove_service_link_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_add_remove_service_link_input.go new file mode 100644 index 0000000000..5366b4841b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_add_remove_service_link_input.go @@ -0,0 +1,79 @@ +package client + +const ( + ADD_REMOVE_SERVICE_LINK_INPUT_TYPE = "addRemoveServiceLinkInput" +) + +type AddRemoveServiceLinkInput struct { + Resource + + ServiceLink ServiceLink `json:"serviceLink,omitempty" yaml:"service_link,omitempty"` +} + +type AddRemoveServiceLinkInputCollection struct { + Collection + Data []AddRemoveServiceLinkInput `json:"data,omitempty"` + client *AddRemoveServiceLinkInputClient +} + +type AddRemoveServiceLinkInputClient struct { + rancherClient *RancherClient +} + +type AddRemoveServiceLinkInputOperations interface { + List(opts *ListOpts) (*AddRemoveServiceLinkInputCollection, error) + Create(opts *AddRemoveServiceLinkInput) (*AddRemoveServiceLinkInput, error) + Update(existing *AddRemoveServiceLinkInput, updates interface{}) (*AddRemoveServiceLinkInput, error) + ById(id string) (*AddRemoveServiceLinkInput, error) + Delete(container *AddRemoveServiceLinkInput) error +} + +func newAddRemoveServiceLinkInputClient(rancherClient *RancherClient) *AddRemoveServiceLinkInputClient { + return &AddRemoveServiceLinkInputClient{ + rancherClient: rancherClient, + } +} + +func (c *AddRemoveServiceLinkInputClient) Create(container *AddRemoveServiceLinkInput) (*AddRemoveServiceLinkInput, error) { + resp := &AddRemoveServiceLinkInput{} + err := c.rancherClient.doCreate(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *AddRemoveServiceLinkInputClient) Update(existing *AddRemoveServiceLinkInput, updates interface{}) (*AddRemoveServiceLinkInput, error) { + resp := &AddRemoveServiceLinkInput{} + err := c.rancherClient.doUpdate(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AddRemoveServiceLinkInputClient) List(opts *ListOpts) (*AddRemoveServiceLinkInputCollection, error) { + resp := &AddRemoveServiceLinkInputCollection{} + err := c.rancherClient.doList(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AddRemoveServiceLinkInputCollection) Next() (*AddRemoveServiceLinkInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AddRemoveServiceLinkInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AddRemoveServiceLinkInputClient) ById(id string) (*AddRemoveServiceLinkInput, error) { + resp := &AddRemoveServiceLinkInput{} + err := c.rancherClient.doById(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AddRemoveServiceLinkInputClient) Delete(container *AddRemoveServiceLinkInput) error { + return c.rancherClient.doResourceDelete(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_agent.go b/vendor/github.com/rancher/go-rancher/v2/generated_agent.go new file mode 100644 index 0000000000..d384631170 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_agent.go @@ -0,0 +1,206 @@ +package client + +const ( + AGENT_TYPE = "agent" +) + +type Agent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ManagedConfig bool `json:"managedConfig,omitempty" yaml:"managed_config,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type AgentCollection struct { + Collection + Data []Agent `json:"data,omitempty"` + client *AgentClient +} + +type AgentClient struct { + rancherClient *RancherClient +} + +type AgentOperations interface { + List(opts *ListOpts) (*AgentCollection, error) + Create(opts *Agent) (*Agent, error) + Update(existing *Agent, updates interface{}) (*Agent, error) + ById(id string) (*Agent, error) + Delete(container *Agent) error + + ActionActivate(*Agent) (*Agent, error) + + ActionCreate(*Agent) (*Agent, error) + + ActionDeactivate(*Agent) (*Agent, error) + + ActionDisconnect(*Agent) (*Agent, error) + + ActionFinishreconnect(*Agent) (*Agent, error) + + ActionPurge(*Agent) (*Agent, error) + + ActionReconnect(*Agent) (*Agent, error) + + ActionRemove(*Agent) (*Agent, error) + + ActionUpdate(*Agent) (*Agent, error) +} + +func newAgentClient(rancherClient *RancherClient) *AgentClient { + return &AgentClient{ + rancherClient: rancherClient, + } +} + +func (c *AgentClient) Create(container *Agent) (*Agent, error) { + resp := &Agent{} + err := c.rancherClient.doCreate(AGENT_TYPE, container, resp) + return resp, err +} + +func (c *AgentClient) Update(existing *Agent, updates interface{}) (*Agent, error) { + resp := &Agent{} + err := c.rancherClient.doUpdate(AGENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AgentClient) List(opts *ListOpts) (*AgentCollection, error) { + resp := &AgentCollection{} + err := c.rancherClient.doList(AGENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AgentCollection) Next() (*AgentCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AgentCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AgentClient) ById(id string) (*Agent, error) { + resp := &Agent{} + err := c.rancherClient.doById(AGENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AgentClient) Delete(container *Agent) error { + return c.rancherClient.doResourceDelete(AGENT_TYPE, &container.Resource) +} + +func (c *AgentClient) ActionActivate(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionCreate(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionDeactivate(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionDisconnect(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "disconnect", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionFinishreconnect(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "finishreconnect", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionPurge(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionReconnect(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "reconnect", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionRemove(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *AgentClient) ActionUpdate(resource *Agent) (*Agent, error) { + + resp := &Agent{} + + err := c.rancherClient.doAction(AGENT_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_amazonec2config.go b/vendor/github.com/rancher/go-rancher/v2/generated_amazonec2config.go new file mode 100644 index 0000000000..d75359519c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_amazonec2config.go @@ -0,0 +1,137 @@ +package client + +const ( + AMAZONEC2CONFIG_TYPE = "amazonec2Config" +) + +type Amazonec2Config struct { + Resource + + AccessKey string `json:"accessKey,omitempty" yaml:"access_key,omitempty"` + + Ami string `json:"ami,omitempty" yaml:"ami,omitempty"` + + BlockDurationMinutes string `json:"blockDurationMinutes,omitempty" yaml:"block_duration_minutes,omitempty"` + + DeviceName string `json:"deviceName,omitempty" yaml:"device_name,omitempty"` + + Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` + + IamInstanceProfile string `json:"iamInstanceProfile,omitempty" yaml:"iam_instance_profile,omitempty"` + + InsecureTransport bool `json:"insecureTransport,omitempty" yaml:"insecure_transport,omitempty"` + + InstanceType string `json:"instanceType,omitempty" yaml:"instance_type,omitempty"` + + KeypairName string `json:"keypairName,omitempty" yaml:"keypair_name,omitempty"` + + Monitoring bool `json:"monitoring,omitempty" yaml:"monitoring,omitempty"` + + OpenPort []string `json:"openPort,omitempty" yaml:"open_port,omitempty"` + + PrivateAddressOnly bool `json:"privateAddressOnly,omitempty" yaml:"private_address_only,omitempty"` + + Region string `json:"region,omitempty" yaml:"region,omitempty"` + + RequestSpotInstance bool `json:"requestSpotInstance,omitempty" yaml:"request_spot_instance,omitempty"` + + Retries string `json:"retries,omitempty" yaml:"retries,omitempty"` + + RootSize string `json:"rootSize,omitempty" yaml:"root_size,omitempty"` + + SecretKey string `json:"secretKey,omitempty" yaml:"secret_key,omitempty"` + + SecurityGroup []string `json:"securityGroup,omitempty" yaml:"security_group,omitempty"` + + SessionToken string `json:"sessionToken,omitempty" yaml:"session_token,omitempty"` + + SpotPrice string `json:"spotPrice,omitempty" yaml:"spot_price,omitempty"` + + SshKeypath string `json:"sshKeypath,omitempty" yaml:"ssh_keypath,omitempty"` + + SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"` + + SubnetId string `json:"subnetId,omitempty" yaml:"subnet_id,omitempty"` + + Tags string `json:"tags,omitempty" yaml:"tags,omitempty"` + + UseEbsOptimizedInstance bool `json:"useEbsOptimizedInstance,omitempty" yaml:"use_ebs_optimized_instance,omitempty"` + + UsePrivateAddress bool `json:"usePrivateAddress,omitempty" yaml:"use_private_address,omitempty"` + + Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"` + + VolumeType string `json:"volumeType,omitempty" yaml:"volume_type,omitempty"` + + VpcId string `json:"vpcId,omitempty" yaml:"vpc_id,omitempty"` + + Zone string `json:"zone,omitempty" yaml:"zone,omitempty"` +} + +type Amazonec2ConfigCollection struct { + Collection + Data []Amazonec2Config `json:"data,omitempty"` + client *Amazonec2ConfigClient +} + +type Amazonec2ConfigClient struct { + rancherClient *RancherClient +} + +type Amazonec2ConfigOperations interface { + List(opts *ListOpts) (*Amazonec2ConfigCollection, error) + Create(opts *Amazonec2Config) (*Amazonec2Config, error) + Update(existing *Amazonec2Config, updates interface{}) (*Amazonec2Config, error) + ById(id string) (*Amazonec2Config, error) + Delete(container *Amazonec2Config) error +} + +func newAmazonec2ConfigClient(rancherClient *RancherClient) *Amazonec2ConfigClient { + return &Amazonec2ConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *Amazonec2ConfigClient) Create(container *Amazonec2Config) (*Amazonec2Config, error) { + resp := &Amazonec2Config{} + err := c.rancherClient.doCreate(AMAZONEC2CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *Amazonec2ConfigClient) Update(existing *Amazonec2Config, updates interface{}) (*Amazonec2Config, error) { + resp := &Amazonec2Config{} + err := c.rancherClient.doUpdate(AMAZONEC2CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *Amazonec2ConfigClient) List(opts *ListOpts) (*Amazonec2ConfigCollection, error) { + resp := &Amazonec2ConfigCollection{} + err := c.rancherClient.doList(AMAZONEC2CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *Amazonec2ConfigCollection) Next() (*Amazonec2ConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &Amazonec2ConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *Amazonec2ConfigClient) ById(id string) (*Amazonec2Config, error) { + resp := &Amazonec2Config{} + err := c.rancherClient.doById(AMAZONEC2CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *Amazonec2ConfigClient) Delete(container *Amazonec2Config) error { + return c.rancherClient.doResourceDelete(AMAZONEC2CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_api_key.go b/vendor/github.com/rancher/go-rancher/v2/generated_api_key.go new file mode 100644 index 0000000000..91dc09dca6 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_api_key.go @@ -0,0 +1,173 @@ +package client + +const ( + API_KEY_TYPE = "apiKey" +) + +type ApiKey struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicValue string `json:"publicValue,omitempty" yaml:"public_value,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SecretValue string `json:"secretValue,omitempty" yaml:"secret_value,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ApiKeyCollection struct { + Collection + Data []ApiKey `json:"data,omitempty"` + client *ApiKeyClient +} + +type ApiKeyClient struct { + rancherClient *RancherClient +} + +type ApiKeyOperations interface { + List(opts *ListOpts) (*ApiKeyCollection, error) + Create(opts *ApiKey) (*ApiKey, error) + Update(existing *ApiKey, updates interface{}) (*ApiKey, error) + ById(id string) (*ApiKey, error) + Delete(container *ApiKey) error + + ActionActivate(*ApiKey) (*Credential, error) + + ActionCreate(*ApiKey) (*Credential, error) + + ActionDeactivate(*ApiKey) (*Credential, error) + + ActionPurge(*ApiKey) (*Credential, error) + + ActionRemove(*ApiKey) (*Credential, error) + + ActionUpdate(*ApiKey) (*Credential, error) +} + +func newApiKeyClient(rancherClient *RancherClient) *ApiKeyClient { + return &ApiKeyClient{ + rancherClient: rancherClient, + } +} + +func (c *ApiKeyClient) Create(container *ApiKey) (*ApiKey, error) { + resp := &ApiKey{} + err := c.rancherClient.doCreate(API_KEY_TYPE, container, resp) + return resp, err +} + +func (c *ApiKeyClient) Update(existing *ApiKey, updates interface{}) (*ApiKey, error) { + resp := &ApiKey{} + err := c.rancherClient.doUpdate(API_KEY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ApiKeyClient) List(opts *ListOpts) (*ApiKeyCollection, error) { + resp := &ApiKeyCollection{} + err := c.rancherClient.doList(API_KEY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ApiKeyCollection) Next() (*ApiKeyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ApiKeyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ApiKeyClient) ById(id string) (*ApiKey, error) { + resp := &ApiKey{} + err := c.rancherClient.doById(API_KEY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ApiKeyClient) Delete(container *ApiKey) error { + return c.rancherClient.doResourceDelete(API_KEY_TYPE, &container.Resource) +} + +func (c *ApiKeyClient) ActionActivate(resource *ApiKey) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(API_KEY_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ApiKeyClient) ActionCreate(resource *ApiKey) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(API_KEY_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ApiKeyClient) ActionDeactivate(resource *ApiKey) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(API_KEY_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ApiKeyClient) ActionPurge(resource *ApiKey) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(API_KEY_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ApiKeyClient) ActionRemove(resource *ApiKey) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(API_KEY_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ApiKeyClient) ActionUpdate(resource *ApiKey) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(API_KEY_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_audit_log.go b/vendor/github.com/rancher/go-rancher/v2/generated_audit_log.go new file mode 100644 index 0000000000..1c9d4ae0e7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_audit_log.go @@ -0,0 +1,105 @@ +package client + +const ( + AUDIT_LOG_TYPE = "auditLog" +) + +type AuditLog struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AuthType string `json:"authType,omitempty" yaml:"auth_type,omitempty"` + + AuthenticatedAsAccountId string `json:"authenticatedAsAccountId,omitempty" yaml:"authenticated_as_account_id,omitempty"` + + AuthenticatedAsIdentityId string `json:"authenticatedAsIdentityId,omitempty" yaml:"authenticated_as_identity_id,omitempty"` + + ClientIp string `json:"clientIp,omitempty" yaml:"client_ip,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + RequestObject string `json:"requestObject,omitempty" yaml:"request_object,omitempty"` + + ResourceId int64 `json:"resourceId,omitempty" yaml:"resource_id,omitempty"` + + ResourceType string `json:"resourceType,omitempty" yaml:"resource_type,omitempty"` + + ResponseCode string `json:"responseCode,omitempty" yaml:"response_code,omitempty"` + + ResponseObject string `json:"responseObject,omitempty" yaml:"response_object,omitempty"` +} + +type AuditLogCollection struct { + Collection + Data []AuditLog `json:"data,omitempty"` + client *AuditLogClient +} + +type AuditLogClient struct { + rancherClient *RancherClient +} + +type AuditLogOperations interface { + List(opts *ListOpts) (*AuditLogCollection, error) + Create(opts *AuditLog) (*AuditLog, error) + Update(existing *AuditLog, updates interface{}) (*AuditLog, error) + ById(id string) (*AuditLog, error) + Delete(container *AuditLog) error +} + +func newAuditLogClient(rancherClient *RancherClient) *AuditLogClient { + return &AuditLogClient{ + rancherClient: rancherClient, + } +} + +func (c *AuditLogClient) Create(container *AuditLog) (*AuditLog, error) { + resp := &AuditLog{} + err := c.rancherClient.doCreate(AUDIT_LOG_TYPE, container, resp) + return resp, err +} + +func (c *AuditLogClient) Update(existing *AuditLog, updates interface{}) (*AuditLog, error) { + resp := &AuditLog{} + err := c.rancherClient.doUpdate(AUDIT_LOG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AuditLogClient) List(opts *ListOpts) (*AuditLogCollection, error) { + resp := &AuditLogCollection{} + err := c.rancherClient.doList(AUDIT_LOG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AuditLogCollection) Next() (*AuditLogCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AuditLogCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AuditLogClient) ById(id string) (*AuditLog, error) { + resp := &AuditLog{} + err := c.rancherClient.doById(AUDIT_LOG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AuditLogClient) Delete(container *AuditLog) error { + return c.rancherClient.doResourceDelete(AUDIT_LOG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_azure_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_azure_config.go new file mode 100644 index 0000000000..12d1b30d51 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_azure_config.go @@ -0,0 +1,121 @@ +package client + +const ( + AZURE_CONFIG_TYPE = "azureConfig" +) + +type AzureConfig struct { + Resource + + AvailabilitySet string `json:"availabilitySet,omitempty" yaml:"availability_set,omitempty"` + + ClientId string `json:"clientId,omitempty" yaml:"client_id,omitempty"` + + ClientSecret string `json:"clientSecret,omitempty" yaml:"client_secret,omitempty"` + + CustomData string `json:"customData,omitempty" yaml:"custom_data,omitempty"` + + Dns string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DockerPort string `json:"dockerPort,omitempty" yaml:"docker_port,omitempty"` + + Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` + + Image string `json:"image,omitempty" yaml:"image,omitempty"` + + Location string `json:"location,omitempty" yaml:"location,omitempty"` + + NoPublicIp bool `json:"noPublicIp,omitempty" yaml:"no_public_ip,omitempty"` + + OpenPort []string `json:"openPort,omitempty" yaml:"open_port,omitempty"` + + PrivateIpAddress string `json:"privateIpAddress,omitempty" yaml:"private_ip_address,omitempty"` + + ResourceGroup string `json:"resourceGroup,omitempty" yaml:"resource_group,omitempty"` + + Size string `json:"size,omitempty" yaml:"size,omitempty"` + + SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"` + + StaticPublicIp bool `json:"staticPublicIp,omitempty" yaml:"static_public_ip,omitempty"` + + StorageType string `json:"storageType,omitempty" yaml:"storage_type,omitempty"` + + Subnet string `json:"subnet,omitempty" yaml:"subnet,omitempty"` + + SubnetPrefix string `json:"subnetPrefix,omitempty" yaml:"subnet_prefix,omitempty"` + + SubscriptionId string `json:"subscriptionId,omitempty" yaml:"subscription_id,omitempty"` + + UsePrivateIp bool `json:"usePrivateIp,omitempty" yaml:"use_private_ip,omitempty"` + + Vnet string `json:"vnet,omitempty" yaml:"vnet,omitempty"` +} + +type AzureConfigCollection struct { + Collection + Data []AzureConfig `json:"data,omitempty"` + client *AzureConfigClient +} + +type AzureConfigClient struct { + rancherClient *RancherClient +} + +type AzureConfigOperations interface { + List(opts *ListOpts) (*AzureConfigCollection, error) + Create(opts *AzureConfig) (*AzureConfig, error) + Update(existing *AzureConfig, updates interface{}) (*AzureConfig, error) + ById(id string) (*AzureConfig, error) + Delete(container *AzureConfig) error +} + +func newAzureConfigClient(rancherClient *RancherClient) *AzureConfigClient { + return &AzureConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *AzureConfigClient) Create(container *AzureConfig) (*AzureConfig, error) { + resp := &AzureConfig{} + err := c.rancherClient.doCreate(AZURE_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *AzureConfigClient) Update(existing *AzureConfig, updates interface{}) (*AzureConfig, error) { + resp := &AzureConfig{} + err := c.rancherClient.doUpdate(AZURE_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AzureConfigClient) List(opts *ListOpts) (*AzureConfigCollection, error) { + resp := &AzureConfigCollection{} + err := c.rancherClient.doList(AZURE_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AzureConfigCollection) Next() (*AzureConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AzureConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AzureConfigClient) ById(id string) (*AzureConfig, error) { + resp := &AzureConfig{} + err := c.rancherClient.doById(AZURE_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AzureConfigClient) Delete(container *AzureConfig) error { + return c.rancherClient.doResourceDelete(AZURE_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_azureadconfig.go b/vendor/github.com/rancher/go-rancher/v2/generated_azureadconfig.go new file mode 100644 index 0000000000..5b3117fc89 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_azureadconfig.go @@ -0,0 +1,93 @@ +package client + +const ( + AZUREADCONFIG_TYPE = "azureadconfig" +) + +type Azureadconfig struct { + Resource + + AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"` + + AdminAccountPassword string `json:"adminAccountPassword,omitempty" yaml:"admin_account_password,omitempty"` + + AdminAccountUsername string `json:"adminAccountUsername,omitempty" yaml:"admin_account_username,omitempty"` + + ClientId string `json:"clientId,omitempty" yaml:"client_id,omitempty"` + + Domain string `json:"domain,omitempty" yaml:"domain,omitempty"` + + Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + TenantId string `json:"tenantId,omitempty" yaml:"tenant_id,omitempty"` +} + +type AzureadconfigCollection struct { + Collection + Data []Azureadconfig `json:"data,omitempty"` + client *AzureadconfigClient +} + +type AzureadconfigClient struct { + rancherClient *RancherClient +} + +type AzureadconfigOperations interface { + List(opts *ListOpts) (*AzureadconfigCollection, error) + Create(opts *Azureadconfig) (*Azureadconfig, error) + Update(existing *Azureadconfig, updates interface{}) (*Azureadconfig, error) + ById(id string) (*Azureadconfig, error) + Delete(container *Azureadconfig) error +} + +func newAzureadconfigClient(rancherClient *RancherClient) *AzureadconfigClient { + return &AzureadconfigClient{ + rancherClient: rancherClient, + } +} + +func (c *AzureadconfigClient) Create(container *Azureadconfig) (*Azureadconfig, error) { + resp := &Azureadconfig{} + err := c.rancherClient.doCreate(AZUREADCONFIG_TYPE, container, resp) + return resp, err +} + +func (c *AzureadconfigClient) Update(existing *Azureadconfig, updates interface{}) (*Azureadconfig, error) { + resp := &Azureadconfig{} + err := c.rancherClient.doUpdate(AZUREADCONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AzureadconfigClient) List(opts *ListOpts) (*AzureadconfigCollection, error) { + resp := &AzureadconfigCollection{} + err := c.rancherClient.doList(AZUREADCONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AzureadconfigCollection) Next() (*AzureadconfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AzureadconfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AzureadconfigClient) ById(id string) (*Azureadconfig, error) { + resp := &Azureadconfig{} + err := c.rancherClient.doById(AZUREADCONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AzureadconfigClient) Delete(container *Azureadconfig) error { + return c.rancherClient.doResourceDelete(AZUREADCONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_backup.go b/vendor/github.com/rancher/go-rancher/v2/generated_backup.go new file mode 100644 index 0000000000..755605eb0e --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_backup.go @@ -0,0 +1,133 @@ +package client + +const ( + BACKUP_TYPE = "backup" +) + +type Backup struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + BackupTargetId string `json:"backupTargetId,omitempty" yaml:"backup_target_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SnapshotId string `json:"snapshotId,omitempty" yaml:"snapshot_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeId string `json:"volumeId,omitempty" yaml:"volume_id,omitempty"` +} + +type BackupCollection struct { + Collection + Data []Backup `json:"data,omitempty"` + client *BackupClient +} + +type BackupClient struct { + rancherClient *RancherClient +} + +type BackupOperations interface { + List(opts *ListOpts) (*BackupCollection, error) + Create(opts *Backup) (*Backup, error) + Update(existing *Backup, updates interface{}) (*Backup, error) + ById(id string) (*Backup, error) + Delete(container *Backup) error + + ActionCreate(*Backup) (*Backup, error) + + ActionRemove(*Backup) (*Backup, error) +} + +func newBackupClient(rancherClient *RancherClient) *BackupClient { + return &BackupClient{ + rancherClient: rancherClient, + } +} + +func (c *BackupClient) Create(container *Backup) (*Backup, error) { + resp := &Backup{} + err := c.rancherClient.doCreate(BACKUP_TYPE, container, resp) + return resp, err +} + +func (c *BackupClient) Update(existing *Backup, updates interface{}) (*Backup, error) { + resp := &Backup{} + err := c.rancherClient.doUpdate(BACKUP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *BackupClient) List(opts *ListOpts) (*BackupCollection, error) { + resp := &BackupCollection{} + err := c.rancherClient.doList(BACKUP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *BackupCollection) Next() (*BackupCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &BackupCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *BackupClient) ById(id string) (*Backup, error) { + resp := &Backup{} + err := c.rancherClient.doById(BACKUP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *BackupClient) Delete(container *Backup) error { + return c.rancherClient.doResourceDelete(BACKUP_TYPE, &container.Resource) +} + +func (c *BackupClient) ActionCreate(resource *Backup) (*Backup, error) { + + resp := &Backup{} + + err := c.rancherClient.doAction(BACKUP_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *BackupClient) ActionRemove(resource *Backup) (*Backup, error) { + + resp := &Backup{} + + err := c.rancherClient.doAction(BACKUP_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_backup_target.go b/vendor/github.com/rancher/go-rancher/v2/generated_backup_target.go new file mode 100644 index 0000000000..a00f2bc895 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_backup_target.go @@ -0,0 +1,127 @@ +package client + +const ( + BACKUP_TARGET_TYPE = "backupTarget" +) + +type BackupTarget struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NfsConfig *NfsConfig `json:"nfsConfig,omitempty" yaml:"nfs_config,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type BackupTargetCollection struct { + Collection + Data []BackupTarget `json:"data,omitempty"` + client *BackupTargetClient +} + +type BackupTargetClient struct { + rancherClient *RancherClient +} + +type BackupTargetOperations interface { + List(opts *ListOpts) (*BackupTargetCollection, error) + Create(opts *BackupTarget) (*BackupTarget, error) + Update(existing *BackupTarget, updates interface{}) (*BackupTarget, error) + ById(id string) (*BackupTarget, error) + Delete(container *BackupTarget) error + + ActionCreate(*BackupTarget) (*BackupTarget, error) + + ActionRemove(*BackupTarget) (*BackupTarget, error) +} + +func newBackupTargetClient(rancherClient *RancherClient) *BackupTargetClient { + return &BackupTargetClient{ + rancherClient: rancherClient, + } +} + +func (c *BackupTargetClient) Create(container *BackupTarget) (*BackupTarget, error) { + resp := &BackupTarget{} + err := c.rancherClient.doCreate(BACKUP_TARGET_TYPE, container, resp) + return resp, err +} + +func (c *BackupTargetClient) Update(existing *BackupTarget, updates interface{}) (*BackupTarget, error) { + resp := &BackupTarget{} + err := c.rancherClient.doUpdate(BACKUP_TARGET_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *BackupTargetClient) List(opts *ListOpts) (*BackupTargetCollection, error) { + resp := &BackupTargetCollection{} + err := c.rancherClient.doList(BACKUP_TARGET_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *BackupTargetCollection) Next() (*BackupTargetCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &BackupTargetCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *BackupTargetClient) ById(id string) (*BackupTarget, error) { + resp := &BackupTarget{} + err := c.rancherClient.doById(BACKUP_TARGET_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *BackupTargetClient) Delete(container *BackupTarget) error { + return c.rancherClient.doResourceDelete(BACKUP_TARGET_TYPE, &container.Resource) +} + +func (c *BackupTargetClient) ActionCreate(resource *BackupTarget) (*BackupTarget, error) { + + resp := &BackupTarget{} + + err := c.rancherClient.doAction(BACKUP_TARGET_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *BackupTargetClient) ActionRemove(resource *BackupTarget) (*BackupTarget, error) { + + resp := &BackupTarget{} + + err := c.rancherClient.doAction(BACKUP_TARGET_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_base_machine_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_base_machine_config.go new file mode 100644 index 0000000000..0c0112de4a --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_base_machine_config.go @@ -0,0 +1,77 @@ +package client + +const ( + BASE_MACHINE_CONFIG_TYPE = "baseMachineConfig" +) + +type BaseMachineConfig struct { + Resource +} + +type BaseMachineConfigCollection struct { + Collection + Data []BaseMachineConfig `json:"data,omitempty"` + client *BaseMachineConfigClient +} + +type BaseMachineConfigClient struct { + rancherClient *RancherClient +} + +type BaseMachineConfigOperations interface { + List(opts *ListOpts) (*BaseMachineConfigCollection, error) + Create(opts *BaseMachineConfig) (*BaseMachineConfig, error) + Update(existing *BaseMachineConfig, updates interface{}) (*BaseMachineConfig, error) + ById(id string) (*BaseMachineConfig, error) + Delete(container *BaseMachineConfig) error +} + +func newBaseMachineConfigClient(rancherClient *RancherClient) *BaseMachineConfigClient { + return &BaseMachineConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *BaseMachineConfigClient) Create(container *BaseMachineConfig) (*BaseMachineConfig, error) { + resp := &BaseMachineConfig{} + err := c.rancherClient.doCreate(BASE_MACHINE_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *BaseMachineConfigClient) Update(existing *BaseMachineConfig, updates interface{}) (*BaseMachineConfig, error) { + resp := &BaseMachineConfig{} + err := c.rancherClient.doUpdate(BASE_MACHINE_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *BaseMachineConfigClient) List(opts *ListOpts) (*BaseMachineConfigCollection, error) { + resp := &BaseMachineConfigCollection{} + err := c.rancherClient.doList(BASE_MACHINE_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *BaseMachineConfigCollection) Next() (*BaseMachineConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &BaseMachineConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *BaseMachineConfigClient) ById(id string) (*BaseMachineConfig, error) { + resp := &BaseMachineConfig{} + err := c.rancherClient.doById(BASE_MACHINE_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *BaseMachineConfigClient) Delete(container *BaseMachineConfig) error { + return c.rancherClient.doResourceDelete(BASE_MACHINE_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_binding.go b/vendor/github.com/rancher/go-rancher/v2/generated_binding.go new file mode 100644 index 0000000000..9cb4e1758e --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_binding.go @@ -0,0 +1,79 @@ +package client + +const ( + BINDING_TYPE = "binding" +) + +type Binding struct { + Resource + + Services map[string]interface{} `json:"services,omitempty" yaml:"services,omitempty"` +} + +type BindingCollection struct { + Collection + Data []Binding `json:"data,omitempty"` + client *BindingClient +} + +type BindingClient struct { + rancherClient *RancherClient +} + +type BindingOperations interface { + List(opts *ListOpts) (*BindingCollection, error) + Create(opts *Binding) (*Binding, error) + Update(existing *Binding, updates interface{}) (*Binding, error) + ById(id string) (*Binding, error) + Delete(container *Binding) error +} + +func newBindingClient(rancherClient *RancherClient) *BindingClient { + return &BindingClient{ + rancherClient: rancherClient, + } +} + +func (c *BindingClient) Create(container *Binding) (*Binding, error) { + resp := &Binding{} + err := c.rancherClient.doCreate(BINDING_TYPE, container, resp) + return resp, err +} + +func (c *BindingClient) Update(existing *Binding, updates interface{}) (*Binding, error) { + resp := &Binding{} + err := c.rancherClient.doUpdate(BINDING_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *BindingClient) List(opts *ListOpts) (*BindingCollection, error) { + resp := &BindingCollection{} + err := c.rancherClient.doList(BINDING_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *BindingCollection) Next() (*BindingCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &BindingCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *BindingClient) ById(id string) (*Binding, error) { + resp := &Binding{} + err := c.rancherClient.doById(BINDING_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *BindingClient) Delete(container *Binding) error { + return c.rancherClient.doResourceDelete(BINDING_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_blkio_device_option.go b/vendor/github.com/rancher/go-rancher/v2/generated_blkio_device_option.go new file mode 100644 index 0000000000..bc33c7c111 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_blkio_device_option.go @@ -0,0 +1,87 @@ +package client + +const ( + BLKIO_DEVICE_OPTION_TYPE = "blkioDeviceOption" +) + +type BlkioDeviceOption struct { + Resource + + ReadBps int64 `json:"readBps,omitempty" yaml:"read_bps,omitempty"` + + ReadIops int64 `json:"readIops,omitempty" yaml:"read_iops,omitempty"` + + Weight int64 `json:"weight,omitempty" yaml:"weight,omitempty"` + + WriteBps int64 `json:"writeBps,omitempty" yaml:"write_bps,omitempty"` + + WriteIops int64 `json:"writeIops,omitempty" yaml:"write_iops,omitempty"` +} + +type BlkioDeviceOptionCollection struct { + Collection + Data []BlkioDeviceOption `json:"data,omitempty"` + client *BlkioDeviceOptionClient +} + +type BlkioDeviceOptionClient struct { + rancherClient *RancherClient +} + +type BlkioDeviceOptionOperations interface { + List(opts *ListOpts) (*BlkioDeviceOptionCollection, error) + Create(opts *BlkioDeviceOption) (*BlkioDeviceOption, error) + Update(existing *BlkioDeviceOption, updates interface{}) (*BlkioDeviceOption, error) + ById(id string) (*BlkioDeviceOption, error) + Delete(container *BlkioDeviceOption) error +} + +func newBlkioDeviceOptionClient(rancherClient *RancherClient) *BlkioDeviceOptionClient { + return &BlkioDeviceOptionClient{ + rancherClient: rancherClient, + } +} + +func (c *BlkioDeviceOptionClient) Create(container *BlkioDeviceOption) (*BlkioDeviceOption, error) { + resp := &BlkioDeviceOption{} + err := c.rancherClient.doCreate(BLKIO_DEVICE_OPTION_TYPE, container, resp) + return resp, err +} + +func (c *BlkioDeviceOptionClient) Update(existing *BlkioDeviceOption, updates interface{}) (*BlkioDeviceOption, error) { + resp := &BlkioDeviceOption{} + err := c.rancherClient.doUpdate(BLKIO_DEVICE_OPTION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *BlkioDeviceOptionClient) List(opts *ListOpts) (*BlkioDeviceOptionCollection, error) { + resp := &BlkioDeviceOptionCollection{} + err := c.rancherClient.doList(BLKIO_DEVICE_OPTION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *BlkioDeviceOptionCollection) Next() (*BlkioDeviceOptionCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &BlkioDeviceOptionCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *BlkioDeviceOptionClient) ById(id string) (*BlkioDeviceOption, error) { + resp := &BlkioDeviceOption{} + err := c.rancherClient.doById(BLKIO_DEVICE_OPTION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *BlkioDeviceOptionClient) Delete(container *BlkioDeviceOption) error { + return c.rancherClient.doResourceDelete(BLKIO_DEVICE_OPTION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_catalog_template.go b/vendor/github.com/rancher/go-rancher/v2/generated_catalog_template.go new file mode 100644 index 0000000000..67d073e16f --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_catalog_template.go @@ -0,0 +1,93 @@ +package client + +const ( + CATALOG_TEMPLATE_TYPE = "catalogTemplate" +) + +type CatalogTemplate struct { + Resource + + Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"` + + Binding Binding `json:"binding,omitempty" yaml:"binding,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DockerCompose string `json:"dockerCompose,omitempty" yaml:"docker_compose,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RancherCompose string `json:"rancherCompose,omitempty" yaml:"rancher_compose,omitempty"` + + TemplateId string `json:"templateId,omitempty" yaml:"template_id,omitempty"` + + TemplateVersionId string `json:"templateVersionId,omitempty" yaml:"template_version_id,omitempty"` +} + +type CatalogTemplateCollection struct { + Collection + Data []CatalogTemplate `json:"data,omitempty"` + client *CatalogTemplateClient +} + +type CatalogTemplateClient struct { + rancherClient *RancherClient +} + +type CatalogTemplateOperations interface { + List(opts *ListOpts) (*CatalogTemplateCollection, error) + Create(opts *CatalogTemplate) (*CatalogTemplate, error) + Update(existing *CatalogTemplate, updates interface{}) (*CatalogTemplate, error) + ById(id string) (*CatalogTemplate, error) + Delete(container *CatalogTemplate) error +} + +func newCatalogTemplateClient(rancherClient *RancherClient) *CatalogTemplateClient { + return &CatalogTemplateClient{ + rancherClient: rancherClient, + } +} + +func (c *CatalogTemplateClient) Create(container *CatalogTemplate) (*CatalogTemplate, error) { + resp := &CatalogTemplate{} + err := c.rancherClient.doCreate(CATALOG_TEMPLATE_TYPE, container, resp) + return resp, err +} + +func (c *CatalogTemplateClient) Update(existing *CatalogTemplate, updates interface{}) (*CatalogTemplate, error) { + resp := &CatalogTemplate{} + err := c.rancherClient.doUpdate(CATALOG_TEMPLATE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *CatalogTemplateClient) List(opts *ListOpts) (*CatalogTemplateCollection, error) { + resp := &CatalogTemplateCollection{} + err := c.rancherClient.doList(CATALOG_TEMPLATE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *CatalogTemplateCollection) Next() (*CatalogTemplateCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &CatalogTemplateCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *CatalogTemplateClient) ById(id string) (*CatalogTemplate, error) { + resp := &CatalogTemplate{} + err := c.rancherClient.doById(CATALOG_TEMPLATE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *CatalogTemplateClient) Delete(container *CatalogTemplate) error { + return c.rancherClient.doResourceDelete(CATALOG_TEMPLATE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_certificate.go b/vendor/github.com/rancher/go-rancher/v2/generated_certificate.go new file mode 100644 index 0000000000..fc407e8af9 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_certificate.go @@ -0,0 +1,162 @@ +package client + +const ( + CERTIFICATE_TYPE = "certificate" +) + +type Certificate struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"` + + CN string `json:"cN,omitempty" yaml:"cn,omitempty"` + + Cert string `json:"cert,omitempty" yaml:"cert,omitempty"` + + CertChain string `json:"certChain,omitempty" yaml:"cert_chain,omitempty"` + + CertFingerprint string `json:"certFingerprint,omitempty" yaml:"cert_fingerprint,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExpiresAt string `json:"expiresAt,omitempty" yaml:"expires_at,omitempty"` + + IssuedAt string `json:"issuedAt,omitempty" yaml:"issued_at,omitempty"` + + Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty"` + + Key string `json:"key,omitempty" yaml:"key,omitempty"` + + KeySize int64 `json:"keySize,omitempty" yaml:"key_size,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SerialNumber string `json:"serialNumber,omitempty" yaml:"serial_number,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + SubjectAlternativeNames []string `json:"subjectAlternativeNames,omitempty" yaml:"subject_alternative_names,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} + +type CertificateCollection struct { + Collection + Data []Certificate `json:"data,omitempty"` + client *CertificateClient +} + +type CertificateClient struct { + rancherClient *RancherClient +} + +type CertificateOperations interface { + List(opts *ListOpts) (*CertificateCollection, error) + Create(opts *Certificate) (*Certificate, error) + Update(existing *Certificate, updates interface{}) (*Certificate, error) + ById(id string) (*Certificate, error) + Delete(container *Certificate) error + + ActionCreate(*Certificate) (*Certificate, error) + + ActionRemove(*Certificate) (*Certificate, error) + + ActionUpdate(*Certificate) (*Certificate, error) +} + +func newCertificateClient(rancherClient *RancherClient) *CertificateClient { + return &CertificateClient{ + rancherClient: rancherClient, + } +} + +func (c *CertificateClient) Create(container *Certificate) (*Certificate, error) { + resp := &Certificate{} + err := c.rancherClient.doCreate(CERTIFICATE_TYPE, container, resp) + return resp, err +} + +func (c *CertificateClient) Update(existing *Certificate, updates interface{}) (*Certificate, error) { + resp := &Certificate{} + err := c.rancherClient.doUpdate(CERTIFICATE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *CertificateClient) List(opts *ListOpts) (*CertificateCollection, error) { + resp := &CertificateCollection{} + err := c.rancherClient.doList(CERTIFICATE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *CertificateCollection) Next() (*CertificateCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &CertificateCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *CertificateClient) ById(id string) (*Certificate, error) { + resp := &Certificate{} + err := c.rancherClient.doById(CERTIFICATE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *CertificateClient) Delete(container *Certificate) error { + return c.rancherClient.doResourceDelete(CERTIFICATE_TYPE, &container.Resource) +} + +func (c *CertificateClient) ActionCreate(resource *Certificate) (*Certificate, error) { + + resp := &Certificate{} + + err := c.rancherClient.doAction(CERTIFICATE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CertificateClient) ActionRemove(resource *Certificate) (*Certificate, error) { + + resp := &Certificate{} + + err := c.rancherClient.doAction(CERTIFICATE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CertificateClient) ActionUpdate(resource *Certificate) (*Certificate, error) { + + resp := &Certificate{} + + err := c.rancherClient.doAction(CERTIFICATE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_change_secret_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_change_secret_input.go new file mode 100644 index 0000000000..3f866812ad --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_change_secret_input.go @@ -0,0 +1,81 @@ +package client + +const ( + CHANGE_SECRET_INPUT_TYPE = "changeSecretInput" +) + +type ChangeSecretInput struct { + Resource + + NewSecret string `json:"newSecret,omitempty" yaml:"new_secret,omitempty"` + + OldSecret string `json:"oldSecret,omitempty" yaml:"old_secret,omitempty"` +} + +type ChangeSecretInputCollection struct { + Collection + Data []ChangeSecretInput `json:"data,omitempty"` + client *ChangeSecretInputClient +} + +type ChangeSecretInputClient struct { + rancherClient *RancherClient +} + +type ChangeSecretInputOperations interface { + List(opts *ListOpts) (*ChangeSecretInputCollection, error) + Create(opts *ChangeSecretInput) (*ChangeSecretInput, error) + Update(existing *ChangeSecretInput, updates interface{}) (*ChangeSecretInput, error) + ById(id string) (*ChangeSecretInput, error) + Delete(container *ChangeSecretInput) error +} + +func newChangeSecretInputClient(rancherClient *RancherClient) *ChangeSecretInputClient { + return &ChangeSecretInputClient{ + rancherClient: rancherClient, + } +} + +func (c *ChangeSecretInputClient) Create(container *ChangeSecretInput) (*ChangeSecretInput, error) { + resp := &ChangeSecretInput{} + err := c.rancherClient.doCreate(CHANGE_SECRET_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *ChangeSecretInputClient) Update(existing *ChangeSecretInput, updates interface{}) (*ChangeSecretInput, error) { + resp := &ChangeSecretInput{} + err := c.rancherClient.doUpdate(CHANGE_SECRET_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ChangeSecretInputClient) List(opts *ListOpts) (*ChangeSecretInputCollection, error) { + resp := &ChangeSecretInputCollection{} + err := c.rancherClient.doList(CHANGE_SECRET_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ChangeSecretInputCollection) Next() (*ChangeSecretInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ChangeSecretInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ChangeSecretInputClient) ById(id string) (*ChangeSecretInput, error) { + resp := &ChangeSecretInput{} + err := c.rancherClient.doById(CHANGE_SECRET_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ChangeSecretInputClient) Delete(container *ChangeSecretInput) error { + return c.rancherClient.doResourceDelete(CHANGE_SECRET_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_client.go b/vendor/github.com/rancher/go-rancher/v2/generated_client.go new file mode 100644 index 0000000000..244ddb752a --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_client.go @@ -0,0 +1,353 @@ +package client + +type RancherClient struct { + RancherBaseClient + + Account AccountOperations + ActiveSetting ActiveSettingOperations + AddOutputsInput AddOutputsInputOperations + AddRemoveServiceLinkInput AddRemoveServiceLinkInputOperations + Agent AgentOperations + Amazonec2Config Amazonec2ConfigOperations + ApiKey ApiKeyOperations + AuditLog AuditLogOperations + AzureConfig AzureConfigOperations + Azureadconfig AzureadconfigOperations + Backup BackupOperations + BackupTarget BackupTargetOperations + BaseMachineConfig BaseMachineConfigOperations + Binding BindingOperations + BlkioDeviceOption BlkioDeviceOptionOperations + CatalogTemplate CatalogTemplateOperations + Certificate CertificateOperations + ChangeSecretInput ChangeSecretInputOperations + ClusterMembership ClusterMembershipOperations + ComposeConfig ComposeConfigOperations + ComposeConfigInput ComposeConfigInputOperations + ComposeProject ComposeProjectOperations + ComposeService ComposeServiceOperations + ConfigItem ConfigItemOperations + ConfigItemStatus ConfigItemStatusOperations + Container ContainerOperations + ContainerEvent ContainerEventOperations + ContainerExec ContainerExecOperations + ContainerLogs ContainerLogsOperations + ContainerProxy ContainerProxyOperations + Credential CredentialOperations + Databasechangelog DatabasechangelogOperations + Databasechangeloglock DatabasechangeloglockOperations + DefaultNetwork DefaultNetworkOperations + DigitaloceanConfig DigitaloceanConfigOperations + DnsService DnsServiceOperations + DockerBuild DockerBuildOperations + ExtensionImplementation ExtensionImplementationOperations + ExtensionPoint ExtensionPointOperations + ExternalDnsEvent ExternalDnsEventOperations + ExternalEvent ExternalEventOperations + ExternalHandler ExternalHandlerOperations + ExternalHandlerExternalHandlerProcessMap ExternalHandlerExternalHandlerProcessMapOperations + ExternalHandlerProcess ExternalHandlerProcessOperations + ExternalHandlerProcessConfig ExternalHandlerProcessConfigOperations + ExternalHostEvent ExternalHostEventOperations + ExternalService ExternalServiceOperations + ExternalServiceEvent ExternalServiceEventOperations + ExternalStoragePoolEvent ExternalStoragePoolEventOperations + ExternalVolumeEvent ExternalVolumeEventOperations + FieldDocumentation FieldDocumentationOperations + GenericObject GenericObjectOperations + HaConfig HaConfigOperations + HaConfigInput HaConfigInputOperations + HealthcheckInstanceHostMap HealthcheckInstanceHostMapOperations + Host HostOperations + HostAccess HostAccessOperations + HostApiProxyToken HostApiProxyTokenOperations + HostTemplate HostTemplateOperations + Identity IdentityOperations + Image ImageOperations + InServiceUpgradeStrategy InServiceUpgradeStrategyOperations + Instance InstanceOperations + InstanceConsole InstanceConsoleOperations + InstanceConsoleInput InstanceConsoleInputOperations + InstanceHealthCheck InstanceHealthCheckOperations + InstanceLink InstanceLinkOperations + InstanceStop InstanceStopOperations + IpAddress IpAddressOperations + KubernetesService KubernetesServiceOperations + KubernetesStack KubernetesStackOperations + KubernetesStackUpgrade KubernetesStackUpgradeOperations + Label LabelOperations + LaunchConfig LaunchConfigOperations + LbConfig LbConfigOperations + LbTargetConfig LbTargetConfigOperations + LoadBalancerCookieStickinessPolicy LoadBalancerCookieStickinessPolicyOperations + LoadBalancerService LoadBalancerServiceOperations + LocalAuthConfig LocalAuthConfigOperations + LogConfig LogConfigOperations + Machine MachineOperations + MachineDriver MachineDriverOperations + Mount MountOperations + MountEntry MountEntryOperations + Network NetworkOperations + NetworkDriver NetworkDriverOperations + NetworkDriverService NetworkDriverServiceOperations + NetworkPolicyRule NetworkPolicyRuleOperations + NetworkPolicyRuleBetween NetworkPolicyRuleBetweenOperations + NetworkPolicyRuleMember NetworkPolicyRuleMemberOperations + NetworkPolicyRuleWithin NetworkPolicyRuleWithinOperations + NfsConfig NfsConfigOperations + Openldapconfig OpenldapconfigOperations + PacketConfig PacketConfigOperations + Password PasswordOperations + PhysicalHost PhysicalHostOperations + Port PortOperations + PortRule PortRuleOperations + ProcessDefinition ProcessDefinitionOperations + ProcessExecution ProcessExecutionOperations + ProcessInstance ProcessInstanceOperations + ProcessPool ProcessPoolOperations + ProcessSummary ProcessSummaryOperations + Project ProjectOperations + ProjectMember ProjectMemberOperations + ProjectTemplate ProjectTemplateOperations + PublicEndpoint PublicEndpointOperations + Publish PublishOperations + PullTask PullTaskOperations + RecreateOnQuorumStrategyConfig RecreateOnQuorumStrategyConfigOperations + Register RegisterOperations + RegistrationToken RegistrationTokenOperations + Registry RegistryOperations + RegistryCredential RegistryCredentialOperations + ResourceDefinition ResourceDefinitionOperations + RestartPolicy RestartPolicyOperations + RestoreFromBackupInput RestoreFromBackupInputOperations + RevertToSnapshotInput RevertToSnapshotInputOperations + RollingRestartStrategy RollingRestartStrategyOperations + ScalePolicy ScalePolicyOperations + ScheduledUpgrade ScheduledUpgradeOperations + SecondaryLaunchConfig SecondaryLaunchConfigOperations + Secret SecretOperations + SecretReference SecretReferenceOperations + Service ServiceOperations + ServiceBinding ServiceBindingOperations + ServiceConsumeMap ServiceConsumeMapOperations + ServiceEvent ServiceEventOperations + ServiceExposeMap ServiceExposeMapOperations + ServiceLink ServiceLinkOperations + ServiceLog ServiceLogOperations + ServiceProxy ServiceProxyOperations + ServiceRestart ServiceRestartOperations + ServiceUpgrade ServiceUpgradeOperations + ServiceUpgradeStrategy ServiceUpgradeStrategyOperations + ServicesPortRange ServicesPortRangeOperations + SetProjectMembersInput SetProjectMembersInputOperations + SetServiceLinksInput SetServiceLinksInputOperations + Setting SettingOperations + Snapshot SnapshotOperations + SnapshotBackupInput SnapshotBackupInputOperations + Stack StackOperations + StackUpgrade StackUpgradeOperations + StateTransition StateTransitionOperations + StatsAccess StatsAccessOperations + StorageDriver StorageDriverOperations + StorageDriverService StorageDriverServiceOperations + StoragePool StoragePoolOperations + Subnet SubnetOperations + TargetPortRule TargetPortRuleOperations + Task TaskOperations + TaskInstance TaskInstanceOperations + ToServiceUpgradeStrategy ToServiceUpgradeStrategyOperations + TypeDocumentation TypeDocumentationOperations + Ulimit UlimitOperations + UserPreference UserPreferenceOperations + VirtualMachine VirtualMachineOperations + VirtualMachineDisk VirtualMachineDiskOperations + Volume VolumeOperations + VolumeActivateInput VolumeActivateInputOperations + VolumeSnapshotInput VolumeSnapshotInputOperations + VolumeTemplate VolumeTemplateOperations +} + +func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient { + client := &RancherClient{ + RancherBaseClient: rancherBaseClient, + } + + client.Account = newAccountClient(client) + client.ActiveSetting = newActiveSettingClient(client) + client.AddOutputsInput = newAddOutputsInputClient(client) + client.AddRemoveServiceLinkInput = newAddRemoveServiceLinkInputClient(client) + client.Agent = newAgentClient(client) + client.Amazonec2Config = newAmazonec2ConfigClient(client) + client.ApiKey = newApiKeyClient(client) + client.AuditLog = newAuditLogClient(client) + client.AzureConfig = newAzureConfigClient(client) + client.Azureadconfig = newAzureadconfigClient(client) + client.Backup = newBackupClient(client) + client.BackupTarget = newBackupTargetClient(client) + client.BaseMachineConfig = newBaseMachineConfigClient(client) + client.Binding = newBindingClient(client) + client.BlkioDeviceOption = newBlkioDeviceOptionClient(client) + client.CatalogTemplate = newCatalogTemplateClient(client) + client.Certificate = newCertificateClient(client) + client.ChangeSecretInput = newChangeSecretInputClient(client) + client.ClusterMembership = newClusterMembershipClient(client) + client.ComposeConfig = newComposeConfigClient(client) + client.ComposeConfigInput = newComposeConfigInputClient(client) + client.ComposeProject = newComposeProjectClient(client) + client.ComposeService = newComposeServiceClient(client) + client.ConfigItem = newConfigItemClient(client) + client.ConfigItemStatus = newConfigItemStatusClient(client) + client.Container = newContainerClient(client) + client.ContainerEvent = newContainerEventClient(client) + client.ContainerExec = newContainerExecClient(client) + client.ContainerLogs = newContainerLogsClient(client) + client.ContainerProxy = newContainerProxyClient(client) + client.Credential = newCredentialClient(client) + client.Databasechangelog = newDatabasechangelogClient(client) + client.Databasechangeloglock = newDatabasechangeloglockClient(client) + client.DefaultNetwork = newDefaultNetworkClient(client) + client.DigitaloceanConfig = newDigitaloceanConfigClient(client) + client.DnsService = newDnsServiceClient(client) + client.DockerBuild = newDockerBuildClient(client) + client.ExtensionImplementation = newExtensionImplementationClient(client) + client.ExtensionPoint = newExtensionPointClient(client) + client.ExternalDnsEvent = newExternalDnsEventClient(client) + client.ExternalEvent = newExternalEventClient(client) + client.ExternalHandler = newExternalHandlerClient(client) + client.ExternalHandlerExternalHandlerProcessMap = newExternalHandlerExternalHandlerProcessMapClient(client) + client.ExternalHandlerProcess = newExternalHandlerProcessClient(client) + client.ExternalHandlerProcessConfig = newExternalHandlerProcessConfigClient(client) + client.ExternalHostEvent = newExternalHostEventClient(client) + client.ExternalService = newExternalServiceClient(client) + client.ExternalServiceEvent = newExternalServiceEventClient(client) + client.ExternalStoragePoolEvent = newExternalStoragePoolEventClient(client) + client.ExternalVolumeEvent = newExternalVolumeEventClient(client) + client.FieldDocumentation = newFieldDocumentationClient(client) + client.GenericObject = newGenericObjectClient(client) + client.HaConfig = newHaConfigClient(client) + client.HaConfigInput = newHaConfigInputClient(client) + client.HealthcheckInstanceHostMap = newHealthcheckInstanceHostMapClient(client) + client.Host = newHostClient(client) + client.HostAccess = newHostAccessClient(client) + client.HostApiProxyToken = newHostApiProxyTokenClient(client) + client.HostTemplate = newHostTemplateClient(client) + client.Identity = newIdentityClient(client) + client.Image = newImageClient(client) + client.InServiceUpgradeStrategy = newInServiceUpgradeStrategyClient(client) + client.Instance = newInstanceClient(client) + client.InstanceConsole = newInstanceConsoleClient(client) + client.InstanceConsoleInput = newInstanceConsoleInputClient(client) + client.InstanceHealthCheck = newInstanceHealthCheckClient(client) + client.InstanceLink = newInstanceLinkClient(client) + client.InstanceStop = newInstanceStopClient(client) + client.IpAddress = newIpAddressClient(client) + client.KubernetesService = newKubernetesServiceClient(client) + client.KubernetesStack = newKubernetesStackClient(client) + client.KubernetesStackUpgrade = newKubernetesStackUpgradeClient(client) + client.Label = newLabelClient(client) + client.LaunchConfig = newLaunchConfigClient(client) + client.LbConfig = newLbConfigClient(client) + client.LbTargetConfig = newLbTargetConfigClient(client) + client.LoadBalancerCookieStickinessPolicy = newLoadBalancerCookieStickinessPolicyClient(client) + client.LoadBalancerService = newLoadBalancerServiceClient(client) + client.LocalAuthConfig = newLocalAuthConfigClient(client) + client.LogConfig = newLogConfigClient(client) + client.Machine = newMachineClient(client) + client.MachineDriver = newMachineDriverClient(client) + client.Mount = newMountClient(client) + client.MountEntry = newMountEntryClient(client) + client.Network = newNetworkClient(client) + client.NetworkDriver = newNetworkDriverClient(client) + client.NetworkDriverService = newNetworkDriverServiceClient(client) + client.NetworkPolicyRule = newNetworkPolicyRuleClient(client) + client.NetworkPolicyRuleBetween = newNetworkPolicyRuleBetweenClient(client) + client.NetworkPolicyRuleMember = newNetworkPolicyRuleMemberClient(client) + client.NetworkPolicyRuleWithin = newNetworkPolicyRuleWithinClient(client) + client.NfsConfig = newNfsConfigClient(client) + client.Openldapconfig = newOpenldapconfigClient(client) + client.PacketConfig = newPacketConfigClient(client) + client.Password = newPasswordClient(client) + client.PhysicalHost = newPhysicalHostClient(client) + client.Port = newPortClient(client) + client.PortRule = newPortRuleClient(client) + client.ProcessDefinition = newProcessDefinitionClient(client) + client.ProcessExecution = newProcessExecutionClient(client) + client.ProcessInstance = newProcessInstanceClient(client) + client.ProcessPool = newProcessPoolClient(client) + client.ProcessSummary = newProcessSummaryClient(client) + client.Project = newProjectClient(client) + client.ProjectMember = newProjectMemberClient(client) + client.ProjectTemplate = newProjectTemplateClient(client) + client.PublicEndpoint = newPublicEndpointClient(client) + client.Publish = newPublishClient(client) + client.PullTask = newPullTaskClient(client) + client.RecreateOnQuorumStrategyConfig = newRecreateOnQuorumStrategyConfigClient(client) + client.Register = newRegisterClient(client) + client.RegistrationToken = newRegistrationTokenClient(client) + client.Registry = newRegistryClient(client) + client.RegistryCredential = newRegistryCredentialClient(client) + client.ResourceDefinition = newResourceDefinitionClient(client) + client.RestartPolicy = newRestartPolicyClient(client) + client.RestoreFromBackupInput = newRestoreFromBackupInputClient(client) + client.RevertToSnapshotInput = newRevertToSnapshotInputClient(client) + client.RollingRestartStrategy = newRollingRestartStrategyClient(client) + client.ScalePolicy = newScalePolicyClient(client) + client.ScheduledUpgrade = newScheduledUpgradeClient(client) + client.SecondaryLaunchConfig = newSecondaryLaunchConfigClient(client) + client.Secret = newSecretClient(client) + client.SecretReference = newSecretReferenceClient(client) + client.Service = newServiceClient(client) + client.ServiceBinding = newServiceBindingClient(client) + client.ServiceConsumeMap = newServiceConsumeMapClient(client) + client.ServiceEvent = newServiceEventClient(client) + client.ServiceExposeMap = newServiceExposeMapClient(client) + client.ServiceLink = newServiceLinkClient(client) + client.ServiceLog = newServiceLogClient(client) + client.ServiceProxy = newServiceProxyClient(client) + client.ServiceRestart = newServiceRestartClient(client) + client.ServiceUpgrade = newServiceUpgradeClient(client) + client.ServiceUpgradeStrategy = newServiceUpgradeStrategyClient(client) + client.ServicesPortRange = newServicesPortRangeClient(client) + client.SetProjectMembersInput = newSetProjectMembersInputClient(client) + client.SetServiceLinksInput = newSetServiceLinksInputClient(client) + client.Setting = newSettingClient(client) + client.Snapshot = newSnapshotClient(client) + client.SnapshotBackupInput = newSnapshotBackupInputClient(client) + client.Stack = newStackClient(client) + client.StackUpgrade = newStackUpgradeClient(client) + client.StateTransition = newStateTransitionClient(client) + client.StatsAccess = newStatsAccessClient(client) + client.StorageDriver = newStorageDriverClient(client) + client.StorageDriverService = newStorageDriverServiceClient(client) + client.StoragePool = newStoragePoolClient(client) + client.Subnet = newSubnetClient(client) + client.TargetPortRule = newTargetPortRuleClient(client) + client.Task = newTaskClient(client) + client.TaskInstance = newTaskInstanceClient(client) + client.ToServiceUpgradeStrategy = newToServiceUpgradeStrategyClient(client) + client.TypeDocumentation = newTypeDocumentationClient(client) + client.Ulimit = newUlimitClient(client) + client.UserPreference = newUserPreferenceClient(client) + client.VirtualMachine = newVirtualMachineClient(client) + client.VirtualMachineDisk = newVirtualMachineDiskClient(client) + client.Volume = newVolumeClient(client) + client.VolumeActivateInput = newVolumeActivateInputClient(client) + client.VolumeSnapshotInput = newVolumeSnapshotInputClient(client) + client.VolumeTemplate = newVolumeTemplateClient(client) + + return client +} + +func NewRancherClient(opts *ClientOpts) (*RancherClient, error) { + rancherBaseClient := &RancherBaseClientImpl{ + Types: map[string]Schema{}, + } + client := constructClient(rancherBaseClient) + + err := setupRancherBaseClient(rancherBaseClient, opts) + if err != nil { + return nil, err + } + + return client, nil +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_cluster_membership.go b/vendor/github.com/rancher/go-rancher/v2/generated_cluster_membership.go new file mode 100644 index 0000000000..f5848633e4 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_cluster_membership.go @@ -0,0 +1,87 @@ +package client + +const ( + CLUSTER_MEMBERSHIP_TYPE = "clusterMembership" +) + +type ClusterMembership struct { + Resource + + Clustered bool `json:"clustered,omitempty" yaml:"clustered,omitempty"` + + Config string `json:"config,omitempty" yaml:"config,omitempty"` + + Heartbeat int64 `json:"heartbeat,omitempty" yaml:"heartbeat,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ClusterMembershipCollection struct { + Collection + Data []ClusterMembership `json:"data,omitempty"` + client *ClusterMembershipClient +} + +type ClusterMembershipClient struct { + rancherClient *RancherClient +} + +type ClusterMembershipOperations interface { + List(opts *ListOpts) (*ClusterMembershipCollection, error) + Create(opts *ClusterMembership) (*ClusterMembership, error) + Update(existing *ClusterMembership, updates interface{}) (*ClusterMembership, error) + ById(id string) (*ClusterMembership, error) + Delete(container *ClusterMembership) error +} + +func newClusterMembershipClient(rancherClient *RancherClient) *ClusterMembershipClient { + return &ClusterMembershipClient{ + rancherClient: rancherClient, + } +} + +func (c *ClusterMembershipClient) Create(container *ClusterMembership) (*ClusterMembership, error) { + resp := &ClusterMembership{} + err := c.rancherClient.doCreate(CLUSTER_MEMBERSHIP_TYPE, container, resp) + return resp, err +} + +func (c *ClusterMembershipClient) Update(existing *ClusterMembership, updates interface{}) (*ClusterMembership, error) { + resp := &ClusterMembership{} + err := c.rancherClient.doUpdate(CLUSTER_MEMBERSHIP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ClusterMembershipClient) List(opts *ListOpts) (*ClusterMembershipCollection, error) { + resp := &ClusterMembershipCollection{} + err := c.rancherClient.doList(CLUSTER_MEMBERSHIP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ClusterMembershipCollection) Next() (*ClusterMembershipCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ClusterMembershipCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ClusterMembershipClient) ById(id string) (*ClusterMembership, error) { + resp := &ClusterMembership{} + err := c.rancherClient.doById(CLUSTER_MEMBERSHIP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ClusterMembershipClient) Delete(container *ClusterMembership) error { + return c.rancherClient.doResourceDelete(CLUSTER_MEMBERSHIP_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_compose_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_compose_config.go new file mode 100644 index 0000000000..b9bc013c04 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_compose_config.go @@ -0,0 +1,81 @@ +package client + +const ( + COMPOSE_CONFIG_TYPE = "composeConfig" +) + +type ComposeConfig struct { + Resource + + DockerComposeConfig string `json:"dockerComposeConfig,omitempty" yaml:"docker_compose_config,omitempty"` + + RancherComposeConfig string `json:"rancherComposeConfig,omitempty" yaml:"rancher_compose_config,omitempty"` +} + +type ComposeConfigCollection struct { + Collection + Data []ComposeConfig `json:"data,omitempty"` + client *ComposeConfigClient +} + +type ComposeConfigClient struct { + rancherClient *RancherClient +} + +type ComposeConfigOperations interface { + List(opts *ListOpts) (*ComposeConfigCollection, error) + Create(opts *ComposeConfig) (*ComposeConfig, error) + Update(existing *ComposeConfig, updates interface{}) (*ComposeConfig, error) + ById(id string) (*ComposeConfig, error) + Delete(container *ComposeConfig) error +} + +func newComposeConfigClient(rancherClient *RancherClient) *ComposeConfigClient { + return &ComposeConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *ComposeConfigClient) Create(container *ComposeConfig) (*ComposeConfig, error) { + resp := &ComposeConfig{} + err := c.rancherClient.doCreate(COMPOSE_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *ComposeConfigClient) Update(existing *ComposeConfig, updates interface{}) (*ComposeConfig, error) { + resp := &ComposeConfig{} + err := c.rancherClient.doUpdate(COMPOSE_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ComposeConfigClient) List(opts *ListOpts) (*ComposeConfigCollection, error) { + resp := &ComposeConfigCollection{} + err := c.rancherClient.doList(COMPOSE_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ComposeConfigCollection) Next() (*ComposeConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ComposeConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ComposeConfigClient) ById(id string) (*ComposeConfig, error) { + resp := &ComposeConfig{} + err := c.rancherClient.doById(COMPOSE_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ComposeConfigClient) Delete(container *ComposeConfig) error { + return c.rancherClient.doResourceDelete(COMPOSE_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_compose_config_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_compose_config_input.go new file mode 100644 index 0000000000..3d03d923b7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_compose_config_input.go @@ -0,0 +1,79 @@ +package client + +const ( + COMPOSE_CONFIG_INPUT_TYPE = "composeConfigInput" +) + +type ComposeConfigInput struct { + Resource + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` +} + +type ComposeConfigInputCollection struct { + Collection + Data []ComposeConfigInput `json:"data,omitempty"` + client *ComposeConfigInputClient +} + +type ComposeConfigInputClient struct { + rancherClient *RancherClient +} + +type ComposeConfigInputOperations interface { + List(opts *ListOpts) (*ComposeConfigInputCollection, error) + Create(opts *ComposeConfigInput) (*ComposeConfigInput, error) + Update(existing *ComposeConfigInput, updates interface{}) (*ComposeConfigInput, error) + ById(id string) (*ComposeConfigInput, error) + Delete(container *ComposeConfigInput) error +} + +func newComposeConfigInputClient(rancherClient *RancherClient) *ComposeConfigInputClient { + return &ComposeConfigInputClient{ + rancherClient: rancherClient, + } +} + +func (c *ComposeConfigInputClient) Create(container *ComposeConfigInput) (*ComposeConfigInput, error) { + resp := &ComposeConfigInput{} + err := c.rancherClient.doCreate(COMPOSE_CONFIG_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *ComposeConfigInputClient) Update(existing *ComposeConfigInput, updates interface{}) (*ComposeConfigInput, error) { + resp := &ComposeConfigInput{} + err := c.rancherClient.doUpdate(COMPOSE_CONFIG_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ComposeConfigInputClient) List(opts *ListOpts) (*ComposeConfigInputCollection, error) { + resp := &ComposeConfigInputCollection{} + err := c.rancherClient.doList(COMPOSE_CONFIG_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ComposeConfigInputCollection) Next() (*ComposeConfigInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ComposeConfigInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ComposeConfigInputClient) ById(id string) (*ComposeConfigInput, error) { + resp := &ComposeConfigInput{} + err := c.rancherClient.doById(COMPOSE_CONFIG_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ComposeConfigInputClient) Delete(container *ComposeConfigInput) error { + return c.rancherClient.doResourceDelete(COMPOSE_CONFIG_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_compose_project.go b/vendor/github.com/rancher/go-rancher/v2/generated_compose_project.go new file mode 100644 index 0000000000..b191a887d3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_compose_project.go @@ -0,0 +1,191 @@ +package client + +const ( + COMPOSE_PROJECT_TYPE = "composeProject" +) + +type ComposeProject struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"` + + Binding *Binding `json:"binding,omitempty" yaml:"binding,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Group string `json:"group,omitempty" yaml:"group,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PreviousEnvironment map[string]interface{} `json:"previousEnvironment,omitempty" yaml:"previous_environment,omitempty"` + + PreviousExternalId string `json:"previousExternalId,omitempty" yaml:"previous_external_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ComposeProjectCollection struct { + Collection + Data []ComposeProject `json:"data,omitempty"` + client *ComposeProjectClient +} + +type ComposeProjectClient struct { + rancherClient *RancherClient +} + +type ComposeProjectOperations interface { + List(opts *ListOpts) (*ComposeProjectCollection, error) + Create(opts *ComposeProject) (*ComposeProject, error) + Update(existing *ComposeProject, updates interface{}) (*ComposeProject, error) + ById(id string) (*ComposeProject, error) + Delete(container *ComposeProject) error + + ActionCancelupgrade(*ComposeProject) (*Stack, error) + + ActionCreate(*ComposeProject) (*Stack, error) + + ActionError(*ComposeProject) (*Stack, error) + + ActionFinishupgrade(*ComposeProject) (*Stack, error) + + ActionRemove(*ComposeProject) (*Stack, error) + + ActionRollback(*ComposeProject) (*Stack, error) +} + +func newComposeProjectClient(rancherClient *RancherClient) *ComposeProjectClient { + return &ComposeProjectClient{ + rancherClient: rancherClient, + } +} + +func (c *ComposeProjectClient) Create(container *ComposeProject) (*ComposeProject, error) { + resp := &ComposeProject{} + err := c.rancherClient.doCreate(COMPOSE_PROJECT_TYPE, container, resp) + return resp, err +} + +func (c *ComposeProjectClient) Update(existing *ComposeProject, updates interface{}) (*ComposeProject, error) { + resp := &ComposeProject{} + err := c.rancherClient.doUpdate(COMPOSE_PROJECT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ComposeProjectClient) List(opts *ListOpts) (*ComposeProjectCollection, error) { + resp := &ComposeProjectCollection{} + err := c.rancherClient.doList(COMPOSE_PROJECT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ComposeProjectCollection) Next() (*ComposeProjectCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ComposeProjectCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ComposeProjectClient) ById(id string) (*ComposeProject, error) { + resp := &ComposeProject{} + err := c.rancherClient.doById(COMPOSE_PROJECT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ComposeProjectClient) Delete(container *ComposeProject) error { + return c.rancherClient.doResourceDelete(COMPOSE_PROJECT_TYPE, &container.Resource) +} + +func (c *ComposeProjectClient) ActionCancelupgrade(resource *ComposeProject) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeProjectClient) ActionCreate(resource *ComposeProject) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeProjectClient) ActionFinishupgrade(resource *ComposeProject) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeProjectClient) ActionRemove(resource *ComposeProject) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeProjectClient) ActionRollback(resource *ComposeProject) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_compose_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_compose_service.go new file mode 100644 index 0000000000..ca7a297f47 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_compose_service.go @@ -0,0 +1,212 @@ +package client + +const ( + COMPOSE_SERVICE_TYPE = "composeService" +) + +type ComposeService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + + SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` + + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vip string `json:"vip,omitempty" yaml:"vip,omitempty"` +} + +type ComposeServiceCollection struct { + Collection + Data []ComposeService `json:"data,omitempty"` + client *ComposeServiceClient +} + +type ComposeServiceClient struct { + rancherClient *RancherClient +} + +type ComposeServiceOperations interface { + List(opts *ListOpts) (*ComposeServiceCollection, error) + Create(opts *ComposeService) (*ComposeService, error) + Update(existing *ComposeService, updates interface{}) (*ComposeService, error) + ById(id string) (*ComposeService, error) + Delete(container *ComposeService) error + + ActionActivate(*ComposeService) (*Service, error) + + ActionCancelupgrade(*ComposeService) (*Service, error) + + ActionContinueupgrade(*ComposeService) (*Service, error) + + ActionCreate(*ComposeService) (*Service, error) + + ActionFinishupgrade(*ComposeService) (*Service, error) + + ActionRemove(*ComposeService) (*Service, error) + + ActionRollback(*ComposeService) (*Service, error) +} + +func newComposeServiceClient(rancherClient *RancherClient) *ComposeServiceClient { + return &ComposeServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *ComposeServiceClient) Create(container *ComposeService) (*ComposeService, error) { + resp := &ComposeService{} + err := c.rancherClient.doCreate(COMPOSE_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *ComposeServiceClient) Update(existing *ComposeService, updates interface{}) (*ComposeService, error) { + resp := &ComposeService{} + err := c.rancherClient.doUpdate(COMPOSE_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ComposeServiceClient) List(opts *ListOpts) (*ComposeServiceCollection, error) { + resp := &ComposeServiceCollection{} + err := c.rancherClient.doList(COMPOSE_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ComposeServiceCollection) Next() (*ComposeServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ComposeServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ComposeServiceClient) ById(id string) (*ComposeService, error) { + resp := &ComposeService{} + err := c.rancherClient.doById(COMPOSE_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ComposeServiceClient) Delete(container *ComposeService) error { + return c.rancherClient.doResourceDelete(COMPOSE_SERVICE_TYPE, &container.Resource) +} + +func (c *ComposeServiceClient) ActionActivate(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeServiceClient) ActionContinueupgrade(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeServiceClient) ActionCreate(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeServiceClient) ActionFinishupgrade(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeServiceClient) ActionRemove(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ComposeServiceClient) ActionRollback(resource *ComposeService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_config_item.go b/vendor/github.com/rancher/go-rancher/v2/generated_config_item.go new file mode 100644 index 0000000000..b973066697 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_config_item.go @@ -0,0 +1,81 @@ +package client + +const ( + CONFIG_ITEM_TYPE = "configItem" +) + +type ConfigItem struct { + Resource + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + SourceVersion string `json:"sourceVersion,omitempty" yaml:"source_version,omitempty"` +} + +type ConfigItemCollection struct { + Collection + Data []ConfigItem `json:"data,omitempty"` + client *ConfigItemClient +} + +type ConfigItemClient struct { + rancherClient *RancherClient +} + +type ConfigItemOperations interface { + List(opts *ListOpts) (*ConfigItemCollection, error) + Create(opts *ConfigItem) (*ConfigItem, error) + Update(existing *ConfigItem, updates interface{}) (*ConfigItem, error) + ById(id string) (*ConfigItem, error) + Delete(container *ConfigItem) error +} + +func newConfigItemClient(rancherClient *RancherClient) *ConfigItemClient { + return &ConfigItemClient{ + rancherClient: rancherClient, + } +} + +func (c *ConfigItemClient) Create(container *ConfigItem) (*ConfigItem, error) { + resp := &ConfigItem{} + err := c.rancherClient.doCreate(CONFIG_ITEM_TYPE, container, resp) + return resp, err +} + +func (c *ConfigItemClient) Update(existing *ConfigItem, updates interface{}) (*ConfigItem, error) { + resp := &ConfigItem{} + err := c.rancherClient.doUpdate(CONFIG_ITEM_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ConfigItemClient) List(opts *ListOpts) (*ConfigItemCollection, error) { + resp := &ConfigItemCollection{} + err := c.rancherClient.doList(CONFIG_ITEM_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ConfigItemCollection) Next() (*ConfigItemCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ConfigItemCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ConfigItemClient) ById(id string) (*ConfigItem, error) { + resp := &ConfigItem{} + err := c.rancherClient.doById(CONFIG_ITEM_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ConfigItemClient) Delete(container *ConfigItem) error { + return c.rancherClient.doResourceDelete(CONFIG_ITEM_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_config_item_status.go b/vendor/github.com/rancher/go-rancher/v2/generated_config_item_status.go new file mode 100644 index 0000000000..2ce32ca971 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_config_item_status.go @@ -0,0 +1,93 @@ +package client + +const ( + CONFIG_ITEM_STATUS_TYPE = "configItemStatus" +) + +type ConfigItemStatus struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` + + AppliedUpdated string `json:"appliedUpdated,omitempty" yaml:"applied_updated,omitempty"` + + AppliedVersion int64 `json:"appliedVersion,omitempty" yaml:"applied_version,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RequestedUpdated string `json:"requestedUpdated,omitempty" yaml:"requested_updated,omitempty"` + + RequestedVersion int64 `json:"requestedVersion,omitempty" yaml:"requested_version,omitempty"` + + SourceVersion string `json:"sourceVersion,omitempty" yaml:"source_version,omitempty"` +} + +type ConfigItemStatusCollection struct { + Collection + Data []ConfigItemStatus `json:"data,omitempty"` + client *ConfigItemStatusClient +} + +type ConfigItemStatusClient struct { + rancherClient *RancherClient +} + +type ConfigItemStatusOperations interface { + List(opts *ListOpts) (*ConfigItemStatusCollection, error) + Create(opts *ConfigItemStatus) (*ConfigItemStatus, error) + Update(existing *ConfigItemStatus, updates interface{}) (*ConfigItemStatus, error) + ById(id string) (*ConfigItemStatus, error) + Delete(container *ConfigItemStatus) error +} + +func newConfigItemStatusClient(rancherClient *RancherClient) *ConfigItemStatusClient { + return &ConfigItemStatusClient{ + rancherClient: rancherClient, + } +} + +func (c *ConfigItemStatusClient) Create(container *ConfigItemStatus) (*ConfigItemStatus, error) { + resp := &ConfigItemStatus{} + err := c.rancherClient.doCreate(CONFIG_ITEM_STATUS_TYPE, container, resp) + return resp, err +} + +func (c *ConfigItemStatusClient) Update(existing *ConfigItemStatus, updates interface{}) (*ConfigItemStatus, error) { + resp := &ConfigItemStatus{} + err := c.rancherClient.doUpdate(CONFIG_ITEM_STATUS_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ConfigItemStatusClient) List(opts *ListOpts) (*ConfigItemStatusCollection, error) { + resp := &ConfigItemStatusCollection{} + err := c.rancherClient.doList(CONFIG_ITEM_STATUS_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ConfigItemStatusCollection) Next() (*ConfigItemStatusCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ConfigItemStatusCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ConfigItemStatusClient) ById(id string) (*ConfigItemStatus, error) { + resp := &ConfigItemStatus{} + err := c.rancherClient.doById(CONFIG_ITEM_STATUS_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ConfigItemStatusClient) Delete(container *ConfigItemStatus) error { + return c.rancherClient.doResourceDelete(CONFIG_ITEM_STATUS_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_container.go b/vendor/github.com/rancher/go-rancher/v2/generated_container.go new file mode 100644 index 0000000000..4cdf2a4e49 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_container.go @@ -0,0 +1,517 @@ +package client + +const ( + CONTAINER_TYPE = "container" +) + +type Container struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` + + AllocationState string `json:"allocationState,omitempty" yaml:"allocation_state,omitempty"` + + BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"` + + BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"` + + Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"` + + CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"` + + CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,omitempty"` + + CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"` + + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + + Count int64 `json:"count,omitempty" yaml:"count,omitempty"` + + CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"` + + CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"` + + CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"` + + CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"` + + CpuRealtimePeriod int64 `json:"cpuRealtimePeriod,omitempty" yaml:"cpu_realtime_period,omitempty"` + + CpuRealtimeRuntime int64 `json:"cpuRealtimeRuntime,omitempty" yaml:"cpu_realtime_runtime,omitempty"` + + CpuSet string `json:"cpuSet,omitempty" yaml:"cpu_set,omitempty"` + + CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"` + + CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DataVolumeMounts map[string]interface{} `json:"dataVolumeMounts,omitempty" yaml:"data_volume_mounts,omitempty"` + + DataVolumes []string `json:"dataVolumes,omitempty" yaml:"data_volumes,omitempty"` + + DataVolumesFrom []string `json:"dataVolumesFrom,omitempty" yaml:"data_volumes_from,omitempty"` + + DeploymentUnitUuid string `json:"deploymentUnitUuid,omitempty" yaml:"deployment_unit_uuid,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Devices []string `json:"devices,omitempty" yaml:"devices,omitempty"` + + DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"` + + Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"` + + DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"` + + DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"` + + EntryPoint []string `json:"entryPoint,omitempty" yaml:"entry_point,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + Expose []string `json:"expose,omitempty" yaml:"expose,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExtraHosts []string `json:"extraHosts,omitempty" yaml:"extra_hosts,omitempty"` + + FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"` + + GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"` + + HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"` + + HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"` + + HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"` + + HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + ImageUuid string `json:"imageUuid,omitempty" yaml:"image_uuid,omitempty"` + + InstanceLinks map[string]interface{} `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"` + + InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"` + + IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"` + + IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"` + + Ip string `json:"ip,omitempty" yaml:"ip,omitempty"` + + Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"` + + IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"` + + Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"` + + KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + LogConfig *LogConfig `json:"logConfig,omitempty" yaml:"log_config,omitempty"` + + LxcConf map[string]interface{} `json:"lxcConf,omitempty" yaml:"lxc_conf,omitempty"` + + Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"` + + MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"` + + MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"` + + MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"` + + MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"` + + Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"` + + NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"` + + NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"` + + NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"` + + NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"` + + OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"` + + OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"` + + PidMode string `json:"pidMode,omitempty" yaml:"pid_mode,omitempty"` + + PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + + PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"` + + PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"` + + Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` + + PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,omitempty"` + + ReadOnly bool `json:"readOnly,omitempty" yaml:"read_only,omitempty"` + + RegistryCredentialId string `json:"registryCredentialId,omitempty" yaml:"registry_credential_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RequestedHostId string `json:"requestedHostId,omitempty" yaml:"requested_host_id,omitempty"` + + RestartPolicy *RestartPolicy `json:"restartPolicy,omitempty" yaml:"restart_policy,omitempty"` + + RunInit bool `json:"runInit,omitempty" yaml:"run_init,omitempty"` + + Secrets []SecretReference `json:"secrets,omitempty" yaml:"secrets,omitempty"` + + SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StdinOpen bool `json:"stdinOpen,omitempty" yaml:"stdin_open,omitempty"` + + StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"` + + StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"` + + StorageOpt map[string]interface{} `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"` + + Sysctls map[string]interface{} `json:"sysctls,omitempty" yaml:"sysctls,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Tmpfs map[string]interface{} `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` + + Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` + + User string `json:"user,omitempty" yaml:"user,omitempty"` + + UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"` + + UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"` + + Uts string `json:"uts,omitempty" yaml:"uts,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` + + VolumeDriver string `json:"volumeDriver,omitempty" yaml:"volume_driver,omitempty"` + + WorkingDir string `json:"workingDir,omitempty" yaml:"working_dir,omitempty"` +} + +type ContainerCollection struct { + Collection + Data []Container `json:"data,omitempty"` + client *ContainerClient +} + +type ContainerClient struct { + rancherClient *RancherClient +} + +type ContainerOperations interface { + List(opts *ListOpts) (*ContainerCollection, error) + Create(opts *Container) (*Container, error) + Update(existing *Container, updates interface{}) (*Container, error) + ById(id string) (*Container, error) + Delete(container *Container) error + + ActionAllocate(*Container) (*Instance, error) + + ActionConsole(*Container, *InstanceConsoleInput) (*InstanceConsole, error) + + ActionCreate(*Container) (*Instance, error) + + ActionDeallocate(*Container) (*Instance, error) + + ActionError(*Container) (*Instance, error) + + ActionExecute(*Container, *ContainerExec) (*HostAccess, error) + + ActionLogs(*Container, *ContainerLogs) (*HostAccess, error) + + ActionMigrate(*Container) (*Instance, error) + + ActionProxy(*Container, *ContainerProxy) (*HostAccess, error) + + ActionPurge(*Container) (*Instance, error) + + ActionRemove(*Container) (*Instance, error) + + ActionRestart(*Container) (*Instance, error) + + ActionStart(*Container) (*Instance, error) + + ActionStop(*Container, *InstanceStop) (*Instance, error) + + ActionUpdate(*Container) (*Instance, error) + + ActionUpdatehealthy(*Container) (*Instance, error) + + ActionUpdatereinitializing(*Container) (*Instance, error) + + ActionUpdateunhealthy(*Container) (*Instance, error) +} + +func newContainerClient(rancherClient *RancherClient) *ContainerClient { + return &ContainerClient{ + rancherClient: rancherClient, + } +} + +func (c *ContainerClient) Create(container *Container) (*Container, error) { + resp := &Container{} + err := c.rancherClient.doCreate(CONTAINER_TYPE, container, resp) + return resp, err +} + +func (c *ContainerClient) Update(existing *Container, updates interface{}) (*Container, error) { + resp := &Container{} + err := c.rancherClient.doUpdate(CONTAINER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ContainerClient) List(opts *ListOpts) (*ContainerCollection, error) { + resp := &ContainerCollection{} + err := c.rancherClient.doList(CONTAINER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ContainerCollection) Next() (*ContainerCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ContainerCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ContainerClient) ById(id string) (*Container, error) { + resp := &Container{} + err := c.rancherClient.doById(CONTAINER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ContainerClient) Delete(container *Container) error { + return c.rancherClient.doResourceDelete(CONTAINER_TYPE, &container.Resource) +} + +func (c *ContainerClient) ActionAllocate(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "allocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionConsole(resource *Container, input *InstanceConsoleInput) (*InstanceConsole, error) { + + resp := &InstanceConsole{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "console", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ContainerClient) ActionCreate(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionDeallocate(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "deallocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionError(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionExecute(resource *Container, input *ContainerExec) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "execute", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ContainerClient) ActionLogs(resource *Container, input *ContainerLogs) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "logs", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ContainerClient) ActionMigrate(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "migrate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionProxy(resource *Container, input *ContainerProxy) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "proxy", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ContainerClient) ActionPurge(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionRemove(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionRestart(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "restart", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionStart(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "start", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionStop(resource *Container, input *InstanceStop) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "stop", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ContainerClient) ActionUpdate(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionUpdatehealthy(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "updatehealthy", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionUpdatereinitializing(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "updatereinitializing", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerClient) ActionUpdateunhealthy(resource *Container) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(CONTAINER_TYPE, "updateunhealthy", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_container_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_container_event.go new file mode 100644 index 0000000000..8b95651c98 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_container_event.go @@ -0,0 +1,129 @@ +package client + +const ( + CONTAINER_EVENT_TYPE = "containerEvent" +) + +type ContainerEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DockerInspect interface{} `json:"dockerInspect,omitempty" yaml:"docker_inspect,omitempty"` + + ExternalFrom string `json:"externalFrom,omitempty" yaml:"external_from,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExternalStatus string `json:"externalStatus,omitempty" yaml:"external_status,omitempty"` + + ExternalTimestamp int64 `json:"externalTimestamp,omitempty" yaml:"external_timestamp,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedHostUuid string `json:"reportedHostUuid,omitempty" yaml:"reported_host_uuid,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` +} + +type ContainerEventCollection struct { + Collection + Data []ContainerEvent `json:"data,omitempty"` + client *ContainerEventClient +} + +type ContainerEventClient struct { + rancherClient *RancherClient +} + +type ContainerEventOperations interface { + List(opts *ListOpts) (*ContainerEventCollection, error) + Create(opts *ContainerEvent) (*ContainerEvent, error) + Update(existing *ContainerEvent, updates interface{}) (*ContainerEvent, error) + ById(id string) (*ContainerEvent, error) + Delete(container *ContainerEvent) error + + ActionCreate(*ContainerEvent) (*ContainerEvent, error) + + ActionRemove(*ContainerEvent) (*ContainerEvent, error) +} + +func newContainerEventClient(rancherClient *RancherClient) *ContainerEventClient { + return &ContainerEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ContainerEventClient) Create(container *ContainerEvent) (*ContainerEvent, error) { + resp := &ContainerEvent{} + err := c.rancherClient.doCreate(CONTAINER_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ContainerEventClient) Update(existing *ContainerEvent, updates interface{}) (*ContainerEvent, error) { + resp := &ContainerEvent{} + err := c.rancherClient.doUpdate(CONTAINER_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ContainerEventClient) List(opts *ListOpts) (*ContainerEventCollection, error) { + resp := &ContainerEventCollection{} + err := c.rancherClient.doList(CONTAINER_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ContainerEventCollection) Next() (*ContainerEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ContainerEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ContainerEventClient) ById(id string) (*ContainerEvent, error) { + resp := &ContainerEvent{} + err := c.rancherClient.doById(CONTAINER_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ContainerEventClient) Delete(container *ContainerEvent) error { + return c.rancherClient.doResourceDelete(CONTAINER_EVENT_TYPE, &container.Resource) +} + +func (c *ContainerEventClient) ActionCreate(resource *ContainerEvent) (*ContainerEvent, error) { + + resp := &ContainerEvent{} + + err := c.rancherClient.doAction(CONTAINER_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ContainerEventClient) ActionRemove(resource *ContainerEvent) (*ContainerEvent, error) { + + resp := &ContainerEvent{} + + err := c.rancherClient.doAction(CONTAINER_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_container_exec.go b/vendor/github.com/rancher/go-rancher/v2/generated_container_exec.go new file mode 100644 index 0000000000..196199b5c9 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_container_exec.go @@ -0,0 +1,85 @@ +package client + +const ( + CONTAINER_EXEC_TYPE = "containerExec" +) + +type ContainerExec struct { + Resource + + AttachStdin bool `json:"attachStdin,omitempty" yaml:"attach_stdin,omitempty"` + + AttachStdout bool `json:"attachStdout,omitempty" yaml:"attach_stdout,omitempty"` + + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + + Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` +} + +type ContainerExecCollection struct { + Collection + Data []ContainerExec `json:"data,omitempty"` + client *ContainerExecClient +} + +type ContainerExecClient struct { + rancherClient *RancherClient +} + +type ContainerExecOperations interface { + List(opts *ListOpts) (*ContainerExecCollection, error) + Create(opts *ContainerExec) (*ContainerExec, error) + Update(existing *ContainerExec, updates interface{}) (*ContainerExec, error) + ById(id string) (*ContainerExec, error) + Delete(container *ContainerExec) error +} + +func newContainerExecClient(rancherClient *RancherClient) *ContainerExecClient { + return &ContainerExecClient{ + rancherClient: rancherClient, + } +} + +func (c *ContainerExecClient) Create(container *ContainerExec) (*ContainerExec, error) { + resp := &ContainerExec{} + err := c.rancherClient.doCreate(CONTAINER_EXEC_TYPE, container, resp) + return resp, err +} + +func (c *ContainerExecClient) Update(existing *ContainerExec, updates interface{}) (*ContainerExec, error) { + resp := &ContainerExec{} + err := c.rancherClient.doUpdate(CONTAINER_EXEC_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ContainerExecClient) List(opts *ListOpts) (*ContainerExecCollection, error) { + resp := &ContainerExecCollection{} + err := c.rancherClient.doList(CONTAINER_EXEC_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ContainerExecCollection) Next() (*ContainerExecCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ContainerExecCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ContainerExecClient) ById(id string) (*ContainerExec, error) { + resp := &ContainerExec{} + err := c.rancherClient.doById(CONTAINER_EXEC_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ContainerExecClient) Delete(container *ContainerExec) error { + return c.rancherClient.doResourceDelete(CONTAINER_EXEC_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_container_logs.go b/vendor/github.com/rancher/go-rancher/v2/generated_container_logs.go new file mode 100644 index 0000000000..2149df19f3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_container_logs.go @@ -0,0 +1,81 @@ +package client + +const ( + CONTAINER_LOGS_TYPE = "containerLogs" +) + +type ContainerLogs struct { + Resource + + Follow bool `json:"follow,omitempty" yaml:"follow,omitempty"` + + Lines int64 `json:"lines,omitempty" yaml:"lines,omitempty"` +} + +type ContainerLogsCollection struct { + Collection + Data []ContainerLogs `json:"data,omitempty"` + client *ContainerLogsClient +} + +type ContainerLogsClient struct { + rancherClient *RancherClient +} + +type ContainerLogsOperations interface { + List(opts *ListOpts) (*ContainerLogsCollection, error) + Create(opts *ContainerLogs) (*ContainerLogs, error) + Update(existing *ContainerLogs, updates interface{}) (*ContainerLogs, error) + ById(id string) (*ContainerLogs, error) + Delete(container *ContainerLogs) error +} + +func newContainerLogsClient(rancherClient *RancherClient) *ContainerLogsClient { + return &ContainerLogsClient{ + rancherClient: rancherClient, + } +} + +func (c *ContainerLogsClient) Create(container *ContainerLogs) (*ContainerLogs, error) { + resp := &ContainerLogs{} + err := c.rancherClient.doCreate(CONTAINER_LOGS_TYPE, container, resp) + return resp, err +} + +func (c *ContainerLogsClient) Update(existing *ContainerLogs, updates interface{}) (*ContainerLogs, error) { + resp := &ContainerLogs{} + err := c.rancherClient.doUpdate(CONTAINER_LOGS_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ContainerLogsClient) List(opts *ListOpts) (*ContainerLogsCollection, error) { + resp := &ContainerLogsCollection{} + err := c.rancherClient.doList(CONTAINER_LOGS_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ContainerLogsCollection) Next() (*ContainerLogsCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ContainerLogsCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ContainerLogsClient) ById(id string) (*ContainerLogs, error) { + resp := &ContainerLogs{} + err := c.rancherClient.doById(CONTAINER_LOGS_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ContainerLogsClient) Delete(container *ContainerLogs) error { + return c.rancherClient.doResourceDelete(CONTAINER_LOGS_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_container_proxy.go b/vendor/github.com/rancher/go-rancher/v2/generated_container_proxy.go new file mode 100644 index 0000000000..84d7670ea0 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_container_proxy.go @@ -0,0 +1,81 @@ +package client + +const ( + CONTAINER_PROXY_TYPE = "containerProxy" +) + +type ContainerProxy struct { + Resource + + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + + Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` +} + +type ContainerProxyCollection struct { + Collection + Data []ContainerProxy `json:"data,omitempty"` + client *ContainerProxyClient +} + +type ContainerProxyClient struct { + rancherClient *RancherClient +} + +type ContainerProxyOperations interface { + List(opts *ListOpts) (*ContainerProxyCollection, error) + Create(opts *ContainerProxy) (*ContainerProxy, error) + Update(existing *ContainerProxy, updates interface{}) (*ContainerProxy, error) + ById(id string) (*ContainerProxy, error) + Delete(container *ContainerProxy) error +} + +func newContainerProxyClient(rancherClient *RancherClient) *ContainerProxyClient { + return &ContainerProxyClient{ + rancherClient: rancherClient, + } +} + +func (c *ContainerProxyClient) Create(container *ContainerProxy) (*ContainerProxy, error) { + resp := &ContainerProxy{} + err := c.rancherClient.doCreate(CONTAINER_PROXY_TYPE, container, resp) + return resp, err +} + +func (c *ContainerProxyClient) Update(existing *ContainerProxy, updates interface{}) (*ContainerProxy, error) { + resp := &ContainerProxy{} + err := c.rancherClient.doUpdate(CONTAINER_PROXY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ContainerProxyClient) List(opts *ListOpts) (*ContainerProxyCollection, error) { + resp := &ContainerProxyCollection{} + err := c.rancherClient.doList(CONTAINER_PROXY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ContainerProxyCollection) Next() (*ContainerProxyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ContainerProxyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ContainerProxyClient) ById(id string) (*ContainerProxy, error) { + resp := &ContainerProxy{} + err := c.rancherClient.doById(CONTAINER_PROXY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ContainerProxyClient) Delete(container *ContainerProxy) error { + return c.rancherClient.doResourceDelete(CONTAINER_PROXY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_credential.go b/vendor/github.com/rancher/go-rancher/v2/generated_credential.go new file mode 100644 index 0000000000..f34a563dfc --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_credential.go @@ -0,0 +1,173 @@ +package client + +const ( + CREDENTIAL_TYPE = "credential" +) + +type Credential struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicValue string `json:"publicValue,omitempty" yaml:"public_value,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SecretValue string `json:"secretValue,omitempty" yaml:"secret_value,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type CredentialCollection struct { + Collection + Data []Credential `json:"data,omitempty"` + client *CredentialClient +} + +type CredentialClient struct { + rancherClient *RancherClient +} + +type CredentialOperations interface { + List(opts *ListOpts) (*CredentialCollection, error) + Create(opts *Credential) (*Credential, error) + Update(existing *Credential, updates interface{}) (*Credential, error) + ById(id string) (*Credential, error) + Delete(container *Credential) error + + ActionActivate(*Credential) (*Credential, error) + + ActionCreate(*Credential) (*Credential, error) + + ActionDeactivate(*Credential) (*Credential, error) + + ActionPurge(*Credential) (*Credential, error) + + ActionRemove(*Credential) (*Credential, error) + + ActionUpdate(*Credential) (*Credential, error) +} + +func newCredentialClient(rancherClient *RancherClient) *CredentialClient { + return &CredentialClient{ + rancherClient: rancherClient, + } +} + +func (c *CredentialClient) Create(container *Credential) (*Credential, error) { + resp := &Credential{} + err := c.rancherClient.doCreate(CREDENTIAL_TYPE, container, resp) + return resp, err +} + +func (c *CredentialClient) Update(existing *Credential, updates interface{}) (*Credential, error) { + resp := &Credential{} + err := c.rancherClient.doUpdate(CREDENTIAL_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *CredentialClient) List(opts *ListOpts) (*CredentialCollection, error) { + resp := &CredentialCollection{} + err := c.rancherClient.doList(CREDENTIAL_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *CredentialCollection) Next() (*CredentialCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &CredentialCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *CredentialClient) ById(id string) (*Credential, error) { + resp := &Credential{} + err := c.rancherClient.doById(CREDENTIAL_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *CredentialClient) Delete(container *Credential) error { + return c.rancherClient.doResourceDelete(CREDENTIAL_TYPE, &container.Resource) +} + +func (c *CredentialClient) ActionActivate(resource *Credential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(CREDENTIAL_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CredentialClient) ActionCreate(resource *Credential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(CREDENTIAL_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CredentialClient) ActionDeactivate(resource *Credential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(CREDENTIAL_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CredentialClient) ActionPurge(resource *Credential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(CREDENTIAL_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CredentialClient) ActionRemove(resource *Credential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(CREDENTIAL_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *CredentialClient) ActionUpdate(resource *Credential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(CREDENTIAL_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_databasechangelog.go b/vendor/github.com/rancher/go-rancher/v2/generated_databasechangelog.go new file mode 100644 index 0000000000..0d935f8a51 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_databasechangelog.go @@ -0,0 +1,97 @@ +package client + +const ( + DATABASECHANGELOG_TYPE = "databasechangelog" +) + +type Databasechangelog struct { + Resource + + Author string `json:"author,omitempty" yaml:"author,omitempty"` + + Comments string `json:"comments,omitempty" yaml:"comments,omitempty"` + + Dateexecuted string `json:"dateexecuted,omitempty" yaml:"dateexecuted,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Exectype string `json:"exectype,omitempty" yaml:"exectype,omitempty"` + + Filename string `json:"filename,omitempty" yaml:"filename,omitempty"` + + Liquibase string `json:"liquibase,omitempty" yaml:"liquibase,omitempty"` + + Md5sum string `json:"md5sum,omitempty" yaml:"md5sum,omitempty"` + + Orderexecuted int64 `json:"orderexecuted,omitempty" yaml:"orderexecuted,omitempty"` + + Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` +} + +type DatabasechangelogCollection struct { + Collection + Data []Databasechangelog `json:"data,omitempty"` + client *DatabasechangelogClient +} + +type DatabasechangelogClient struct { + rancherClient *RancherClient +} + +type DatabasechangelogOperations interface { + List(opts *ListOpts) (*DatabasechangelogCollection, error) + Create(opts *Databasechangelog) (*Databasechangelog, error) + Update(existing *Databasechangelog, updates interface{}) (*Databasechangelog, error) + ById(id string) (*Databasechangelog, error) + Delete(container *Databasechangelog) error +} + +func newDatabasechangelogClient(rancherClient *RancherClient) *DatabasechangelogClient { + return &DatabasechangelogClient{ + rancherClient: rancherClient, + } +} + +func (c *DatabasechangelogClient) Create(container *Databasechangelog) (*Databasechangelog, error) { + resp := &Databasechangelog{} + err := c.rancherClient.doCreate(DATABASECHANGELOG_TYPE, container, resp) + return resp, err +} + +func (c *DatabasechangelogClient) Update(existing *Databasechangelog, updates interface{}) (*Databasechangelog, error) { + resp := &Databasechangelog{} + err := c.rancherClient.doUpdate(DATABASECHANGELOG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DatabasechangelogClient) List(opts *ListOpts) (*DatabasechangelogCollection, error) { + resp := &DatabasechangelogCollection{} + err := c.rancherClient.doList(DATABASECHANGELOG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DatabasechangelogCollection) Next() (*DatabasechangelogCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DatabasechangelogCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DatabasechangelogClient) ById(id string) (*Databasechangelog, error) { + resp := &Databasechangelog{} + err := c.rancherClient.doById(DATABASECHANGELOG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *DatabasechangelogClient) Delete(container *Databasechangelog) error { + return c.rancherClient.doResourceDelete(DATABASECHANGELOG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_databasechangeloglock.go b/vendor/github.com/rancher/go-rancher/v2/generated_databasechangeloglock.go new file mode 100644 index 0000000000..a93c015a04 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_databasechangeloglock.go @@ -0,0 +1,83 @@ +package client + +const ( + DATABASECHANGELOGLOCK_TYPE = "databasechangeloglock" +) + +type Databasechangeloglock struct { + Resource + + Locked bool `json:"locked,omitempty" yaml:"locked,omitempty"` + + Lockedby string `json:"lockedby,omitempty" yaml:"lockedby,omitempty"` + + Lockgranted string `json:"lockgranted,omitempty" yaml:"lockgranted,omitempty"` +} + +type DatabasechangeloglockCollection struct { + Collection + Data []Databasechangeloglock `json:"data,omitempty"` + client *DatabasechangeloglockClient +} + +type DatabasechangeloglockClient struct { + rancherClient *RancherClient +} + +type DatabasechangeloglockOperations interface { + List(opts *ListOpts) (*DatabasechangeloglockCollection, error) + Create(opts *Databasechangeloglock) (*Databasechangeloglock, error) + Update(existing *Databasechangeloglock, updates interface{}) (*Databasechangeloglock, error) + ById(id string) (*Databasechangeloglock, error) + Delete(container *Databasechangeloglock) error +} + +func newDatabasechangeloglockClient(rancherClient *RancherClient) *DatabasechangeloglockClient { + return &DatabasechangeloglockClient{ + rancherClient: rancherClient, + } +} + +func (c *DatabasechangeloglockClient) Create(container *Databasechangeloglock) (*Databasechangeloglock, error) { + resp := &Databasechangeloglock{} + err := c.rancherClient.doCreate(DATABASECHANGELOGLOCK_TYPE, container, resp) + return resp, err +} + +func (c *DatabasechangeloglockClient) Update(existing *Databasechangeloglock, updates interface{}) (*Databasechangeloglock, error) { + resp := &Databasechangeloglock{} + err := c.rancherClient.doUpdate(DATABASECHANGELOGLOCK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DatabasechangeloglockClient) List(opts *ListOpts) (*DatabasechangeloglockCollection, error) { + resp := &DatabasechangeloglockCollection{} + err := c.rancherClient.doList(DATABASECHANGELOGLOCK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DatabasechangeloglockCollection) Next() (*DatabasechangeloglockCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DatabasechangeloglockCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DatabasechangeloglockClient) ById(id string) (*Databasechangeloglock, error) { + resp := &Databasechangeloglock{} + err := c.rancherClient.doById(DATABASECHANGELOGLOCK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *DatabasechangeloglockClient) Delete(container *Databasechangeloglock) error { + return c.rancherClient.doResourceDelete(DATABASECHANGELOGLOCK_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_default_network.go b/vendor/github.com/rancher/go-rancher/v2/generated_default_network.go new file mode 100644 index 0000000000..8cdb206fc2 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_default_network.go @@ -0,0 +1,183 @@ +package client + +const ( + DEFAULT_NETWORK_TYPE = "defaultNetwork" +) + +type DefaultNetwork struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DefaultPolicyAction string `json:"defaultPolicyAction,omitempty" yaml:"default_policy_action,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"` + + HostPorts bool `json:"hostPorts,omitempty" yaml:"host_ports,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Policy []NetworkPolicyRule `json:"policy,omitempty" yaml:"policy,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Subnets []Subnet `json:"subnets,omitempty" yaml:"subnets,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type DefaultNetworkCollection struct { + Collection + Data []DefaultNetwork `json:"data,omitempty"` + client *DefaultNetworkClient +} + +type DefaultNetworkClient struct { + rancherClient *RancherClient +} + +type DefaultNetworkOperations interface { + List(opts *ListOpts) (*DefaultNetworkCollection, error) + Create(opts *DefaultNetwork) (*DefaultNetwork, error) + Update(existing *DefaultNetwork, updates interface{}) (*DefaultNetwork, error) + ById(id string) (*DefaultNetwork, error) + Delete(container *DefaultNetwork) error + + ActionActivate(*DefaultNetwork) (*Network, error) + + ActionCreate(*DefaultNetwork) (*Network, error) + + ActionDeactivate(*DefaultNetwork) (*Network, error) + + ActionPurge(*DefaultNetwork) (*Network, error) + + ActionRemove(*DefaultNetwork) (*Network, error) + + ActionUpdate(*DefaultNetwork) (*Network, error) +} + +func newDefaultNetworkClient(rancherClient *RancherClient) *DefaultNetworkClient { + return &DefaultNetworkClient{ + rancherClient: rancherClient, + } +} + +func (c *DefaultNetworkClient) Create(container *DefaultNetwork) (*DefaultNetwork, error) { + resp := &DefaultNetwork{} + err := c.rancherClient.doCreate(DEFAULT_NETWORK_TYPE, container, resp) + return resp, err +} + +func (c *DefaultNetworkClient) Update(existing *DefaultNetwork, updates interface{}) (*DefaultNetwork, error) { + resp := &DefaultNetwork{} + err := c.rancherClient.doUpdate(DEFAULT_NETWORK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DefaultNetworkClient) List(opts *ListOpts) (*DefaultNetworkCollection, error) { + resp := &DefaultNetworkCollection{} + err := c.rancherClient.doList(DEFAULT_NETWORK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DefaultNetworkCollection) Next() (*DefaultNetworkCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DefaultNetworkCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DefaultNetworkClient) ById(id string) (*DefaultNetwork, error) { + resp := &DefaultNetwork{} + err := c.rancherClient.doById(DEFAULT_NETWORK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *DefaultNetworkClient) Delete(container *DefaultNetwork) error { + return c.rancherClient.doResourceDelete(DEFAULT_NETWORK_TYPE, &container.Resource) +} + +func (c *DefaultNetworkClient) ActionActivate(resource *DefaultNetwork) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DefaultNetworkClient) ActionCreate(resource *DefaultNetwork) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DefaultNetworkClient) ActionDeactivate(resource *DefaultNetwork) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DefaultNetworkClient) ActionPurge(resource *DefaultNetwork) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DefaultNetworkClient) ActionRemove(resource *DefaultNetwork) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DefaultNetworkClient) ActionUpdate(resource *DefaultNetwork) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_digitalocean_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_digitalocean_config.go new file mode 100644 index 0000000000..b03c8a0584 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_digitalocean_config.go @@ -0,0 +1,101 @@ +package client + +const ( + DIGITALOCEAN_CONFIG_TYPE = "digitaloceanConfig" +) + +type DigitaloceanConfig struct { + Resource + + AccessToken string `json:"accessToken,omitempty" yaml:"access_token,omitempty"` + + Backups bool `json:"backups,omitempty" yaml:"backups,omitempty"` + + Image string `json:"image,omitempty" yaml:"image,omitempty"` + + Ipv6 bool `json:"ipv6,omitempty" yaml:"ipv6,omitempty"` + + PrivateNetworking bool `json:"privateNetworking,omitempty" yaml:"private_networking,omitempty"` + + Region string `json:"region,omitempty" yaml:"region,omitempty"` + + Size string `json:"size,omitempty" yaml:"size,omitempty"` + + SshKeyFingerprint string `json:"sshKeyFingerprint,omitempty" yaml:"ssh_key_fingerprint,omitempty"` + + SshKeyPath string `json:"sshKeyPath,omitempty" yaml:"ssh_key_path,omitempty"` + + SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"` + + SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"` + + Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"` +} + +type DigitaloceanConfigCollection struct { + Collection + Data []DigitaloceanConfig `json:"data,omitempty"` + client *DigitaloceanConfigClient +} + +type DigitaloceanConfigClient struct { + rancherClient *RancherClient +} + +type DigitaloceanConfigOperations interface { + List(opts *ListOpts) (*DigitaloceanConfigCollection, error) + Create(opts *DigitaloceanConfig) (*DigitaloceanConfig, error) + Update(existing *DigitaloceanConfig, updates interface{}) (*DigitaloceanConfig, error) + ById(id string) (*DigitaloceanConfig, error) + Delete(container *DigitaloceanConfig) error +} + +func newDigitaloceanConfigClient(rancherClient *RancherClient) *DigitaloceanConfigClient { + return &DigitaloceanConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *DigitaloceanConfigClient) Create(container *DigitaloceanConfig) (*DigitaloceanConfig, error) { + resp := &DigitaloceanConfig{} + err := c.rancherClient.doCreate(DIGITALOCEAN_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *DigitaloceanConfigClient) Update(existing *DigitaloceanConfig, updates interface{}) (*DigitaloceanConfig, error) { + resp := &DigitaloceanConfig{} + err := c.rancherClient.doUpdate(DIGITALOCEAN_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DigitaloceanConfigClient) List(opts *ListOpts) (*DigitaloceanConfigCollection, error) { + resp := &DigitaloceanConfigCollection{} + err := c.rancherClient.doList(DIGITALOCEAN_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DigitaloceanConfigCollection) Next() (*DigitaloceanConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DigitaloceanConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DigitaloceanConfigClient) ById(id string) (*DigitaloceanConfig, error) { + resp := &DigitaloceanConfig{} + err := c.rancherClient.doById(DIGITALOCEAN_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *DigitaloceanConfigClient) Delete(container *DigitaloceanConfig) error { + return c.rancherClient.doResourceDelete(DIGITALOCEAN_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_dns_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_dns_service.go new file mode 100644 index 0000000000..d554562aa8 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_dns_service.go @@ -0,0 +1,285 @@ +package client + +const ( + DNS_SERVICE_TYPE = "dnsService" +) + +type DnsService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AssignServiceIpAddress bool `json:"assignServiceIpAddress,omitempty" yaml:"assign_service_ip_address,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RetainIp bool `json:"retainIp,omitempty" yaml:"retain_ip,omitempty"` + + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Upgrade *ServiceUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type DnsServiceCollection struct { + Collection + Data []DnsService `json:"data,omitempty"` + client *DnsServiceClient +} + +type DnsServiceClient struct { + rancherClient *RancherClient +} + +type DnsServiceOperations interface { + List(opts *ListOpts) (*DnsServiceCollection, error) + Create(opts *DnsService) (*DnsService, error) + Update(existing *DnsService, updates interface{}) (*DnsService, error) + ById(id string) (*DnsService, error) + Delete(container *DnsService) error + + ActionActivate(*DnsService) (*Service, error) + + ActionAddservicelink(*DnsService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionCancelupgrade(*DnsService) (*Service, error) + + ActionContinueupgrade(*DnsService) (*Service, error) + + ActionCreate(*DnsService) (*Service, error) + + ActionDeactivate(*DnsService) (*Service, error) + + ActionFinishupgrade(*DnsService) (*Service, error) + + ActionRemove(*DnsService) (*Service, error) + + ActionRemoveservicelink(*DnsService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionRestart(*DnsService, *ServiceRestart) (*Service, error) + + ActionRollback(*DnsService) (*Service, error) + + ActionSetservicelinks(*DnsService, *SetServiceLinksInput) (*Service, error) + + ActionUpdate(*DnsService) (*Service, error) + + ActionUpgrade(*DnsService, *ServiceUpgrade) (*Service, error) +} + +func newDnsServiceClient(rancherClient *RancherClient) *DnsServiceClient { + return &DnsServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *DnsServiceClient) Create(container *DnsService) (*DnsService, error) { + resp := &DnsService{} + err := c.rancherClient.doCreate(DNS_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *DnsServiceClient) Update(existing *DnsService, updates interface{}) (*DnsService, error) { + resp := &DnsService{} + err := c.rancherClient.doUpdate(DNS_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DnsServiceClient) List(opts *ListOpts) (*DnsServiceCollection, error) { + resp := &DnsServiceCollection{} + err := c.rancherClient.doList(DNS_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DnsServiceCollection) Next() (*DnsServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DnsServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DnsServiceClient) ById(id string) (*DnsService, error) { + resp := &DnsService{} + err := c.rancherClient.doById(DNS_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *DnsServiceClient) Delete(container *DnsService) error { + return c.rancherClient.doResourceDelete(DNS_SERVICE_TYPE, &container.Resource) +} + +func (c *DnsServiceClient) ActionActivate(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionAddservicelink(resource *DnsService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionCancelupgrade(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionContinueupgrade(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionCreate(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionDeactivate(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionFinishupgrade(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionRemove(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionRemoveservicelink(resource *DnsService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionRestart(resource *DnsService, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionRollback(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionSetservicelinks(resource *DnsService, input *SetServiceLinksInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionUpdate(resource *DnsService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *DnsServiceClient) ActionUpgrade(resource *DnsService, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_docker_build.go b/vendor/github.com/rancher/go-rancher/v2/generated_docker_build.go new file mode 100644 index 0000000000..a1b1e371b2 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_docker_build.go @@ -0,0 +1,89 @@ +package client + +const ( + DOCKER_BUILD_TYPE = "dockerBuild" +) + +type DockerBuild struct { + Resource + + Context string `json:"context,omitempty" yaml:"context,omitempty"` + + Dockerfile string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"` + + Forcerm bool `json:"forcerm,omitempty" yaml:"forcerm,omitempty"` + + Nocache bool `json:"nocache,omitempty" yaml:"nocache,omitempty"` + + Remote string `json:"remote,omitempty" yaml:"remote,omitempty"` + + Rm bool `json:"rm,omitempty" yaml:"rm,omitempty"` +} + +type DockerBuildCollection struct { + Collection + Data []DockerBuild `json:"data,omitempty"` + client *DockerBuildClient +} + +type DockerBuildClient struct { + rancherClient *RancherClient +} + +type DockerBuildOperations interface { + List(opts *ListOpts) (*DockerBuildCollection, error) + Create(opts *DockerBuild) (*DockerBuild, error) + Update(existing *DockerBuild, updates interface{}) (*DockerBuild, error) + ById(id string) (*DockerBuild, error) + Delete(container *DockerBuild) error +} + +func newDockerBuildClient(rancherClient *RancherClient) *DockerBuildClient { + return &DockerBuildClient{ + rancherClient: rancherClient, + } +} + +func (c *DockerBuildClient) Create(container *DockerBuild) (*DockerBuild, error) { + resp := &DockerBuild{} + err := c.rancherClient.doCreate(DOCKER_BUILD_TYPE, container, resp) + return resp, err +} + +func (c *DockerBuildClient) Update(existing *DockerBuild, updates interface{}) (*DockerBuild, error) { + resp := &DockerBuild{} + err := c.rancherClient.doUpdate(DOCKER_BUILD_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DockerBuildClient) List(opts *ListOpts) (*DockerBuildCollection, error) { + resp := &DockerBuildCollection{} + err := c.rancherClient.doList(DOCKER_BUILD_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DockerBuildCollection) Next() (*DockerBuildCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DockerBuildCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DockerBuildClient) ById(id string) (*DockerBuild, error) { + resp := &DockerBuild{} + err := c.rancherClient.doById(DOCKER_BUILD_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *DockerBuildClient) Delete(container *DockerBuild) error { + return c.rancherClient.doResourceDelete(DOCKER_BUILD_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_extension_implementation.go b/vendor/github.com/rancher/go-rancher/v2/generated_extension_implementation.go new file mode 100644 index 0000000000..216383386f --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_extension_implementation.go @@ -0,0 +1,83 @@ +package client + +const ( + EXTENSION_IMPLEMENTATION_TYPE = "extensionImplementation" +) + +type ExtensionImplementation struct { + Resource + + ClassName string `json:"className,omitempty" yaml:"class_name,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Properties map[string]interface{} `json:"properties,omitempty" yaml:"properties,omitempty"` +} + +type ExtensionImplementationCollection struct { + Collection + Data []ExtensionImplementation `json:"data,omitempty"` + client *ExtensionImplementationClient +} + +type ExtensionImplementationClient struct { + rancherClient *RancherClient +} + +type ExtensionImplementationOperations interface { + List(opts *ListOpts) (*ExtensionImplementationCollection, error) + Create(opts *ExtensionImplementation) (*ExtensionImplementation, error) + Update(existing *ExtensionImplementation, updates interface{}) (*ExtensionImplementation, error) + ById(id string) (*ExtensionImplementation, error) + Delete(container *ExtensionImplementation) error +} + +func newExtensionImplementationClient(rancherClient *RancherClient) *ExtensionImplementationClient { + return &ExtensionImplementationClient{ + rancherClient: rancherClient, + } +} + +func (c *ExtensionImplementationClient) Create(container *ExtensionImplementation) (*ExtensionImplementation, error) { + resp := &ExtensionImplementation{} + err := c.rancherClient.doCreate(EXTENSION_IMPLEMENTATION_TYPE, container, resp) + return resp, err +} + +func (c *ExtensionImplementationClient) Update(existing *ExtensionImplementation, updates interface{}) (*ExtensionImplementation, error) { + resp := &ExtensionImplementation{} + err := c.rancherClient.doUpdate(EXTENSION_IMPLEMENTATION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExtensionImplementationClient) List(opts *ListOpts) (*ExtensionImplementationCollection, error) { + resp := &ExtensionImplementationCollection{} + err := c.rancherClient.doList(EXTENSION_IMPLEMENTATION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExtensionImplementationCollection) Next() (*ExtensionImplementationCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExtensionImplementationCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExtensionImplementationClient) ById(id string) (*ExtensionImplementation, error) { + resp := &ExtensionImplementation{} + err := c.rancherClient.doById(EXTENSION_IMPLEMENTATION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExtensionImplementationClient) Delete(container *ExtensionImplementation) error { + return c.rancherClient.doResourceDelete(EXTENSION_IMPLEMENTATION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_extension_point.go b/vendor/github.com/rancher/go-rancher/v2/generated_extension_point.go new file mode 100644 index 0000000000..e3c0b87ab4 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_extension_point.go @@ -0,0 +1,87 @@ +package client + +const ( + EXTENSION_POINT_TYPE = "extensionPoint" +) + +type ExtensionPoint struct { + Resource + + ExcludeSetting string `json:"excludeSetting,omitempty" yaml:"exclude_setting,omitempty"` + + Implementations []ExtensionImplementation `json:"implementations,omitempty" yaml:"implementations,omitempty"` + + IncludeSetting string `json:"includeSetting,omitempty" yaml:"include_setting,omitempty"` + + ListSetting string `json:"listSetting,omitempty" yaml:"list_setting,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` +} + +type ExtensionPointCollection struct { + Collection + Data []ExtensionPoint `json:"data,omitempty"` + client *ExtensionPointClient +} + +type ExtensionPointClient struct { + rancherClient *RancherClient +} + +type ExtensionPointOperations interface { + List(opts *ListOpts) (*ExtensionPointCollection, error) + Create(opts *ExtensionPoint) (*ExtensionPoint, error) + Update(existing *ExtensionPoint, updates interface{}) (*ExtensionPoint, error) + ById(id string) (*ExtensionPoint, error) + Delete(container *ExtensionPoint) error +} + +func newExtensionPointClient(rancherClient *RancherClient) *ExtensionPointClient { + return &ExtensionPointClient{ + rancherClient: rancherClient, + } +} + +func (c *ExtensionPointClient) Create(container *ExtensionPoint) (*ExtensionPoint, error) { + resp := &ExtensionPoint{} + err := c.rancherClient.doCreate(EXTENSION_POINT_TYPE, container, resp) + return resp, err +} + +func (c *ExtensionPointClient) Update(existing *ExtensionPoint, updates interface{}) (*ExtensionPoint, error) { + resp := &ExtensionPoint{} + err := c.rancherClient.doUpdate(EXTENSION_POINT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExtensionPointClient) List(opts *ListOpts) (*ExtensionPointCollection, error) { + resp := &ExtensionPointCollection{} + err := c.rancherClient.doList(EXTENSION_POINT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExtensionPointCollection) Next() (*ExtensionPointCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExtensionPointCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExtensionPointClient) ById(id string) (*ExtensionPoint, error) { + resp := &ExtensionPoint{} + err := c.rancherClient.doById(EXTENSION_POINT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExtensionPointClient) Delete(container *ExtensionPoint) error { + return c.rancherClient.doResourceDelete(EXTENSION_POINT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_dns_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_dns_event.go new file mode 100644 index 0000000000..e4c6c929b7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_dns_event.go @@ -0,0 +1,129 @@ +package client + +const ( + EXTERNAL_DNS_EVENT_TYPE = "externalDnsEvent" +) + +type ExternalDnsEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedAccountId string `json:"reportedAccountId,omitempty" yaml:"reported_account_id,omitempty"` + + ServiceName string `json:"serviceName,omitempty" yaml:"service_name,omitempty"` + + StackName string `json:"stackName,omitempty" yaml:"stack_name,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalDnsEventCollection struct { + Collection + Data []ExternalDnsEvent `json:"data,omitempty"` + client *ExternalDnsEventClient +} + +type ExternalDnsEventClient struct { + rancherClient *RancherClient +} + +type ExternalDnsEventOperations interface { + List(opts *ListOpts) (*ExternalDnsEventCollection, error) + Create(opts *ExternalDnsEvent) (*ExternalDnsEvent, error) + Update(existing *ExternalDnsEvent, updates interface{}) (*ExternalDnsEvent, error) + ById(id string) (*ExternalDnsEvent, error) + Delete(container *ExternalDnsEvent) error + + ActionCreate(*ExternalDnsEvent) (*ExternalEvent, error) + + ActionRemove(*ExternalDnsEvent) (*ExternalEvent, error) +} + +func newExternalDnsEventClient(rancherClient *RancherClient) *ExternalDnsEventClient { + return &ExternalDnsEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalDnsEventClient) Create(container *ExternalDnsEvent) (*ExternalDnsEvent, error) { + resp := &ExternalDnsEvent{} + err := c.rancherClient.doCreate(EXTERNAL_DNS_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ExternalDnsEventClient) Update(existing *ExternalDnsEvent, updates interface{}) (*ExternalDnsEvent, error) { + resp := &ExternalDnsEvent{} + err := c.rancherClient.doUpdate(EXTERNAL_DNS_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalDnsEventClient) List(opts *ListOpts) (*ExternalDnsEventCollection, error) { + resp := &ExternalDnsEventCollection{} + err := c.rancherClient.doList(EXTERNAL_DNS_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalDnsEventCollection) Next() (*ExternalDnsEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalDnsEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalDnsEventClient) ById(id string) (*ExternalDnsEvent, error) { + resp := &ExternalDnsEvent{} + err := c.rancherClient.doById(EXTERNAL_DNS_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalDnsEventClient) Delete(container *ExternalDnsEvent) error { + return c.rancherClient.doResourceDelete(EXTERNAL_DNS_EVENT_TYPE, &container.Resource) +} + +func (c *ExternalDnsEventClient) ActionCreate(resource *ExternalDnsEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_DNS_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalDnsEventClient) ActionRemove(resource *ExternalDnsEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_DNS_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_event.go new file mode 100644 index 0000000000..3b43545a5f --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_event.go @@ -0,0 +1,123 @@ +package client + +const ( + EXTERNAL_EVENT_TYPE = "externalEvent" +) + +type ExternalEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedAccountId string `json:"reportedAccountId,omitempty" yaml:"reported_account_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalEventCollection struct { + Collection + Data []ExternalEvent `json:"data,omitempty"` + client *ExternalEventClient +} + +type ExternalEventClient struct { + rancherClient *RancherClient +} + +type ExternalEventOperations interface { + List(opts *ListOpts) (*ExternalEventCollection, error) + Create(opts *ExternalEvent) (*ExternalEvent, error) + Update(existing *ExternalEvent, updates interface{}) (*ExternalEvent, error) + ById(id string) (*ExternalEvent, error) + Delete(container *ExternalEvent) error + + ActionCreate(*ExternalEvent) (*ExternalEvent, error) + + ActionRemove(*ExternalEvent) (*ExternalEvent, error) +} + +func newExternalEventClient(rancherClient *RancherClient) *ExternalEventClient { + return &ExternalEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalEventClient) Create(container *ExternalEvent) (*ExternalEvent, error) { + resp := &ExternalEvent{} + err := c.rancherClient.doCreate(EXTERNAL_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ExternalEventClient) Update(existing *ExternalEvent, updates interface{}) (*ExternalEvent, error) { + resp := &ExternalEvent{} + err := c.rancherClient.doUpdate(EXTERNAL_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalEventClient) List(opts *ListOpts) (*ExternalEventCollection, error) { + resp := &ExternalEventCollection{} + err := c.rancherClient.doList(EXTERNAL_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalEventCollection) Next() (*ExternalEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalEventClient) ById(id string) (*ExternalEvent, error) { + resp := &ExternalEvent{} + err := c.rancherClient.doById(EXTERNAL_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalEventClient) Delete(container *ExternalEvent) error { + return c.rancherClient.doResourceDelete(EXTERNAL_EVENT_TYPE, &container.Resource) +} + +func (c *ExternalEventClient) ActionCreate(resource *ExternalEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalEventClient) ActionRemove(resource *ExternalEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_handler.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler.go new file mode 100644 index 0000000000..d0162922d1 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler.go @@ -0,0 +1,175 @@ +package client + +const ( + EXTERNAL_HANDLER_TYPE = "externalHandler" +) + +type ExternalHandler struct { + Resource + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + + ProcessConfigs []ExternalHandlerProcessConfig `json:"processConfigs,omitempty" yaml:"process_configs,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + Retries int64 `json:"retries,omitempty" yaml:"retries,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + TimeoutMillis int64 `json:"timeoutMillis,omitempty" yaml:"timeout_millis,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalHandlerCollection struct { + Collection + Data []ExternalHandler `json:"data,omitempty"` + client *ExternalHandlerClient +} + +type ExternalHandlerClient struct { + rancherClient *RancherClient +} + +type ExternalHandlerOperations interface { + List(opts *ListOpts) (*ExternalHandlerCollection, error) + Create(opts *ExternalHandler) (*ExternalHandler, error) + Update(existing *ExternalHandler, updates interface{}) (*ExternalHandler, error) + ById(id string) (*ExternalHandler, error) + Delete(container *ExternalHandler) error + + ActionActivate(*ExternalHandler) (*ExternalHandler, error) + + ActionCreate(*ExternalHandler) (*ExternalHandler, error) + + ActionDeactivate(*ExternalHandler) (*ExternalHandler, error) + + ActionPurge(*ExternalHandler) (*ExternalHandler, error) + + ActionRemove(*ExternalHandler) (*ExternalHandler, error) + + ActionUpdate(*ExternalHandler) (*ExternalHandler, error) +} + +func newExternalHandlerClient(rancherClient *RancherClient) *ExternalHandlerClient { + return &ExternalHandlerClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalHandlerClient) Create(container *ExternalHandler) (*ExternalHandler, error) { + resp := &ExternalHandler{} + err := c.rancherClient.doCreate(EXTERNAL_HANDLER_TYPE, container, resp) + return resp, err +} + +func (c *ExternalHandlerClient) Update(existing *ExternalHandler, updates interface{}) (*ExternalHandler, error) { + resp := &ExternalHandler{} + err := c.rancherClient.doUpdate(EXTERNAL_HANDLER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalHandlerClient) List(opts *ListOpts) (*ExternalHandlerCollection, error) { + resp := &ExternalHandlerCollection{} + err := c.rancherClient.doList(EXTERNAL_HANDLER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalHandlerCollection) Next() (*ExternalHandlerCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalHandlerCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalHandlerClient) ById(id string) (*ExternalHandler, error) { + resp := &ExternalHandler{} + err := c.rancherClient.doById(EXTERNAL_HANDLER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalHandlerClient) Delete(container *ExternalHandler) error { + return c.rancherClient.doResourceDelete(EXTERNAL_HANDLER_TYPE, &container.Resource) +} + +func (c *ExternalHandlerClient) ActionActivate(resource *ExternalHandler) (*ExternalHandler, error) { + + resp := &ExternalHandler{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerClient) ActionCreate(resource *ExternalHandler) (*ExternalHandler, error) { + + resp := &ExternalHandler{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerClient) ActionDeactivate(resource *ExternalHandler) (*ExternalHandler, error) { + + resp := &ExternalHandler{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerClient) ActionPurge(resource *ExternalHandler) (*ExternalHandler, error) { + + resp := &ExternalHandler{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerClient) ActionRemove(resource *ExternalHandler) (*ExternalHandler, error) { + + resp := &ExternalHandler{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerClient) ActionUpdate(resource *ExternalHandler) (*ExternalHandler, error) { + + resp := &ExternalHandler{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_external_handler_process_map.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_external_handler_process_map.go new file mode 100644 index 0000000000..b111264a20 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_external_handler_process_map.go @@ -0,0 +1,175 @@ +package client + +const ( + EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE = "externalHandlerExternalHandlerProcessMap" +) + +type ExternalHandlerExternalHandlerProcessMap struct { + Resource + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + EventName string `json:"eventName,omitempty" yaml:"event_name,omitempty"` + + ExternalHandlerId string `json:"externalHandlerId,omitempty" yaml:"external_handler_id,omitempty"` + + ExternalHandlerProcessId string `json:"externalHandlerProcessId,omitempty" yaml:"external_handler_process_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + OnError string `json:"onError,omitempty" yaml:"on_error,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalHandlerExternalHandlerProcessMapCollection struct { + Collection + Data []ExternalHandlerExternalHandlerProcessMap `json:"data,omitempty"` + client *ExternalHandlerExternalHandlerProcessMapClient +} + +type ExternalHandlerExternalHandlerProcessMapClient struct { + rancherClient *RancherClient +} + +type ExternalHandlerExternalHandlerProcessMapOperations interface { + List(opts *ListOpts) (*ExternalHandlerExternalHandlerProcessMapCollection, error) + Create(opts *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) + Update(existing *ExternalHandlerExternalHandlerProcessMap, updates interface{}) (*ExternalHandlerExternalHandlerProcessMap, error) + ById(id string) (*ExternalHandlerExternalHandlerProcessMap, error) + Delete(container *ExternalHandlerExternalHandlerProcessMap) error + + ActionActivate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) + + ActionCreate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) + + ActionDeactivate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) + + ActionPurge(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) + + ActionRemove(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) + + ActionUpdate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) +} + +func newExternalHandlerExternalHandlerProcessMapClient(rancherClient *RancherClient) *ExternalHandlerExternalHandlerProcessMapClient { + return &ExternalHandlerExternalHandlerProcessMapClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) Create(container *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + resp := &ExternalHandlerExternalHandlerProcessMap{} + err := c.rancherClient.doCreate(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, container, resp) + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) Update(existing *ExternalHandlerExternalHandlerProcessMap, updates interface{}) (*ExternalHandlerExternalHandlerProcessMap, error) { + resp := &ExternalHandlerExternalHandlerProcessMap{} + err := c.rancherClient.doUpdate(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) List(opts *ListOpts) (*ExternalHandlerExternalHandlerProcessMapCollection, error) { + resp := &ExternalHandlerExternalHandlerProcessMapCollection{} + err := c.rancherClient.doList(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalHandlerExternalHandlerProcessMapCollection) Next() (*ExternalHandlerExternalHandlerProcessMapCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalHandlerExternalHandlerProcessMapCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ById(id string) (*ExternalHandlerExternalHandlerProcessMap, error) { + resp := &ExternalHandlerExternalHandlerProcessMap{} + err := c.rancherClient.doById(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) Delete(container *ExternalHandlerExternalHandlerProcessMap) error { + return c.rancherClient.doResourceDelete(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, &container.Resource) +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionActivate(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + + resp := &ExternalHandlerExternalHandlerProcessMap{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionCreate(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + + resp := &ExternalHandlerExternalHandlerProcessMap{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionDeactivate(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + + resp := &ExternalHandlerExternalHandlerProcessMap{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionPurge(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + + resp := &ExternalHandlerExternalHandlerProcessMap{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionRemove(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + + resp := &ExternalHandlerExternalHandlerProcessMap{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionUpdate(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) { + + resp := &ExternalHandlerExternalHandlerProcessMap{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process.go new file mode 100644 index 0000000000..c9aedf82d5 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process.go @@ -0,0 +1,167 @@ +package client + +const ( + EXTERNAL_HANDLER_PROCESS_TYPE = "externalHandlerProcess" +) + +type ExternalHandlerProcess struct { + Resource + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalHandlerProcessCollection struct { + Collection + Data []ExternalHandlerProcess `json:"data,omitempty"` + client *ExternalHandlerProcessClient +} + +type ExternalHandlerProcessClient struct { + rancherClient *RancherClient +} + +type ExternalHandlerProcessOperations interface { + List(opts *ListOpts) (*ExternalHandlerProcessCollection, error) + Create(opts *ExternalHandlerProcess) (*ExternalHandlerProcess, error) + Update(existing *ExternalHandlerProcess, updates interface{}) (*ExternalHandlerProcess, error) + ById(id string) (*ExternalHandlerProcess, error) + Delete(container *ExternalHandlerProcess) error + + ActionActivate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) + + ActionCreate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) + + ActionDeactivate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) + + ActionPurge(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) + + ActionRemove(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) + + ActionUpdate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) +} + +func newExternalHandlerProcessClient(rancherClient *RancherClient) *ExternalHandlerProcessClient { + return &ExternalHandlerProcessClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalHandlerProcessClient) Create(container *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + resp := &ExternalHandlerProcess{} + err := c.rancherClient.doCreate(EXTERNAL_HANDLER_PROCESS_TYPE, container, resp) + return resp, err +} + +func (c *ExternalHandlerProcessClient) Update(existing *ExternalHandlerProcess, updates interface{}) (*ExternalHandlerProcess, error) { + resp := &ExternalHandlerProcess{} + err := c.rancherClient.doUpdate(EXTERNAL_HANDLER_PROCESS_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalHandlerProcessClient) List(opts *ListOpts) (*ExternalHandlerProcessCollection, error) { + resp := &ExternalHandlerProcessCollection{} + err := c.rancherClient.doList(EXTERNAL_HANDLER_PROCESS_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalHandlerProcessCollection) Next() (*ExternalHandlerProcessCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalHandlerProcessCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalHandlerProcessClient) ById(id string) (*ExternalHandlerProcess, error) { + resp := &ExternalHandlerProcess{} + err := c.rancherClient.doById(EXTERNAL_HANDLER_PROCESS_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalHandlerProcessClient) Delete(container *ExternalHandlerProcess) error { + return c.rancherClient.doResourceDelete(EXTERNAL_HANDLER_PROCESS_TYPE, &container.Resource) +} + +func (c *ExternalHandlerProcessClient) ActionActivate(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + + resp := &ExternalHandlerProcess{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerProcessClient) ActionCreate(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + + resp := &ExternalHandlerProcess{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerProcessClient) ActionDeactivate(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + + resp := &ExternalHandlerProcess{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerProcessClient) ActionPurge(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + + resp := &ExternalHandlerProcess{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerProcessClient) ActionRemove(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + + resp := &ExternalHandlerProcess{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHandlerProcessClient) ActionUpdate(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) { + + resp := &ExternalHandlerProcess{} + + err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process_config.go new file mode 100644 index 0000000000..08d4ab0668 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_handler_process_config.go @@ -0,0 +1,81 @@ +package client + +const ( + EXTERNAL_HANDLER_PROCESS_CONFIG_TYPE = "externalHandlerProcessConfig" +) + +type ExternalHandlerProcessConfig struct { + Resource + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + OnError string `json:"onError,omitempty" yaml:"on_error,omitempty"` +} + +type ExternalHandlerProcessConfigCollection struct { + Collection + Data []ExternalHandlerProcessConfig `json:"data,omitempty"` + client *ExternalHandlerProcessConfigClient +} + +type ExternalHandlerProcessConfigClient struct { + rancherClient *RancherClient +} + +type ExternalHandlerProcessConfigOperations interface { + List(opts *ListOpts) (*ExternalHandlerProcessConfigCollection, error) + Create(opts *ExternalHandlerProcessConfig) (*ExternalHandlerProcessConfig, error) + Update(existing *ExternalHandlerProcessConfig, updates interface{}) (*ExternalHandlerProcessConfig, error) + ById(id string) (*ExternalHandlerProcessConfig, error) + Delete(container *ExternalHandlerProcessConfig) error +} + +func newExternalHandlerProcessConfigClient(rancherClient *RancherClient) *ExternalHandlerProcessConfigClient { + return &ExternalHandlerProcessConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalHandlerProcessConfigClient) Create(container *ExternalHandlerProcessConfig) (*ExternalHandlerProcessConfig, error) { + resp := &ExternalHandlerProcessConfig{} + err := c.rancherClient.doCreate(EXTERNAL_HANDLER_PROCESS_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *ExternalHandlerProcessConfigClient) Update(existing *ExternalHandlerProcessConfig, updates interface{}) (*ExternalHandlerProcessConfig, error) { + resp := &ExternalHandlerProcessConfig{} + err := c.rancherClient.doUpdate(EXTERNAL_HANDLER_PROCESS_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalHandlerProcessConfigClient) List(opts *ListOpts) (*ExternalHandlerProcessConfigCollection, error) { + resp := &ExternalHandlerProcessConfigCollection{} + err := c.rancherClient.doList(EXTERNAL_HANDLER_PROCESS_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalHandlerProcessConfigCollection) Next() (*ExternalHandlerProcessConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalHandlerProcessConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalHandlerProcessConfigClient) ById(id string) (*ExternalHandlerProcessConfig, error) { + resp := &ExternalHandlerProcessConfig{} + err := c.rancherClient.doById(EXTERNAL_HANDLER_PROCESS_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalHandlerProcessConfigClient) Delete(container *ExternalHandlerProcessConfig) error { + return c.rancherClient.doResourceDelete(EXTERNAL_HANDLER_PROCESS_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_host_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_host_event.go new file mode 100644 index 0000000000..e35425eb72 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_host_event.go @@ -0,0 +1,129 @@ +package client + +const ( + EXTERNAL_HOST_EVENT_TYPE = "externalHostEvent" +) + +type ExternalHostEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DeleteHost bool `json:"deleteHost,omitempty" yaml:"delete_host,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + HostLabel string `json:"hostLabel,omitempty" yaml:"host_label,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedAccountId string `json:"reportedAccountId,omitempty" yaml:"reported_account_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalHostEventCollection struct { + Collection + Data []ExternalHostEvent `json:"data,omitempty"` + client *ExternalHostEventClient +} + +type ExternalHostEventClient struct { + rancherClient *RancherClient +} + +type ExternalHostEventOperations interface { + List(opts *ListOpts) (*ExternalHostEventCollection, error) + Create(opts *ExternalHostEvent) (*ExternalHostEvent, error) + Update(existing *ExternalHostEvent, updates interface{}) (*ExternalHostEvent, error) + ById(id string) (*ExternalHostEvent, error) + Delete(container *ExternalHostEvent) error + + ActionCreate(*ExternalHostEvent) (*ExternalEvent, error) + + ActionRemove(*ExternalHostEvent) (*ExternalEvent, error) +} + +func newExternalHostEventClient(rancherClient *RancherClient) *ExternalHostEventClient { + return &ExternalHostEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalHostEventClient) Create(container *ExternalHostEvent) (*ExternalHostEvent, error) { + resp := &ExternalHostEvent{} + err := c.rancherClient.doCreate(EXTERNAL_HOST_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ExternalHostEventClient) Update(existing *ExternalHostEvent, updates interface{}) (*ExternalHostEvent, error) { + resp := &ExternalHostEvent{} + err := c.rancherClient.doUpdate(EXTERNAL_HOST_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalHostEventClient) List(opts *ListOpts) (*ExternalHostEventCollection, error) { + resp := &ExternalHostEventCollection{} + err := c.rancherClient.doList(EXTERNAL_HOST_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalHostEventCollection) Next() (*ExternalHostEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalHostEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalHostEventClient) ById(id string) (*ExternalHostEvent, error) { + resp := &ExternalHostEvent{} + err := c.rancherClient.doById(EXTERNAL_HOST_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalHostEventClient) Delete(container *ExternalHostEvent) error { + return c.rancherClient.doResourceDelete(EXTERNAL_HOST_EVENT_TYPE, &container.Resource) +} + +func (c *ExternalHostEventClient) ActionCreate(resource *ExternalHostEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_HOST_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalHostEventClient) ActionRemove(resource *ExternalHostEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_HOST_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_service.go new file mode 100644 index 0000000000..cc9cf4f31a --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_service.go @@ -0,0 +1,252 @@ +package client + +const ( + EXTERNAL_SERVICE_TYPE = "externalService" +) + +type ExternalService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExternalIpAddresses []string `json:"externalIpAddresses,omitempty" yaml:"external_ip_addresses,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Upgrade *ServiceUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalServiceCollection struct { + Collection + Data []ExternalService `json:"data,omitempty"` + client *ExternalServiceClient +} + +type ExternalServiceClient struct { + rancherClient *RancherClient +} + +type ExternalServiceOperations interface { + List(opts *ListOpts) (*ExternalServiceCollection, error) + Create(opts *ExternalService) (*ExternalService, error) + Update(existing *ExternalService, updates interface{}) (*ExternalService, error) + ById(id string) (*ExternalService, error) + Delete(container *ExternalService) error + + ActionActivate(*ExternalService) (*Service, error) + + ActionCancelupgrade(*ExternalService) (*Service, error) + + ActionContinueupgrade(*ExternalService) (*Service, error) + + ActionCreate(*ExternalService) (*Service, error) + + ActionDeactivate(*ExternalService) (*Service, error) + + ActionFinishupgrade(*ExternalService) (*Service, error) + + ActionRemove(*ExternalService) (*Service, error) + + ActionRestart(*ExternalService, *ServiceRestart) (*Service, error) + + ActionRollback(*ExternalService) (*Service, error) + + ActionUpdate(*ExternalService) (*Service, error) + + ActionUpgrade(*ExternalService, *ServiceUpgrade) (*Service, error) +} + +func newExternalServiceClient(rancherClient *RancherClient) *ExternalServiceClient { + return &ExternalServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalServiceClient) Create(container *ExternalService) (*ExternalService, error) { + resp := &ExternalService{} + err := c.rancherClient.doCreate(EXTERNAL_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *ExternalServiceClient) Update(existing *ExternalService, updates interface{}) (*ExternalService, error) { + resp := &ExternalService{} + err := c.rancherClient.doUpdate(EXTERNAL_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalServiceClient) List(opts *ListOpts) (*ExternalServiceCollection, error) { + resp := &ExternalServiceCollection{} + err := c.rancherClient.doList(EXTERNAL_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalServiceCollection) Next() (*ExternalServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalServiceClient) ById(id string) (*ExternalService, error) { + resp := &ExternalService{} + err := c.rancherClient.doById(EXTERNAL_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalServiceClient) Delete(container *ExternalService) error { + return c.rancherClient.doResourceDelete(EXTERNAL_SERVICE_TYPE, &container.Resource) +} + +func (c *ExternalServiceClient) ActionActivate(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionCancelupgrade(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionContinueupgrade(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionCreate(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionDeactivate(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionFinishupgrade(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionRemove(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionRestart(resource *ExternalService, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionRollback(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionUpdate(resource *ExternalService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceClient) ActionUpgrade(resource *ExternalService, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_service_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_service_event.go new file mode 100644 index 0000000000..59913d2088 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_service_event.go @@ -0,0 +1,127 @@ +package client + +const ( + EXTERNAL_SERVICE_EVENT_TYPE = "externalServiceEvent" +) + +type ExternalServiceEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Environment interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedAccountId string `json:"reportedAccountId,omitempty" yaml:"reported_account_id,omitempty"` + + Service interface{} `json:"service,omitempty" yaml:"service,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalServiceEventCollection struct { + Collection + Data []ExternalServiceEvent `json:"data,omitempty"` + client *ExternalServiceEventClient +} + +type ExternalServiceEventClient struct { + rancherClient *RancherClient +} + +type ExternalServiceEventOperations interface { + List(opts *ListOpts) (*ExternalServiceEventCollection, error) + Create(opts *ExternalServiceEvent) (*ExternalServiceEvent, error) + Update(existing *ExternalServiceEvent, updates interface{}) (*ExternalServiceEvent, error) + ById(id string) (*ExternalServiceEvent, error) + Delete(container *ExternalServiceEvent) error + + ActionCreate(*ExternalServiceEvent) (*ExternalEvent, error) + + ActionRemove(*ExternalServiceEvent) (*ExternalEvent, error) +} + +func newExternalServiceEventClient(rancherClient *RancherClient) *ExternalServiceEventClient { + return &ExternalServiceEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalServiceEventClient) Create(container *ExternalServiceEvent) (*ExternalServiceEvent, error) { + resp := &ExternalServiceEvent{} + err := c.rancherClient.doCreate(EXTERNAL_SERVICE_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ExternalServiceEventClient) Update(existing *ExternalServiceEvent, updates interface{}) (*ExternalServiceEvent, error) { + resp := &ExternalServiceEvent{} + err := c.rancherClient.doUpdate(EXTERNAL_SERVICE_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalServiceEventClient) List(opts *ListOpts) (*ExternalServiceEventCollection, error) { + resp := &ExternalServiceEventCollection{} + err := c.rancherClient.doList(EXTERNAL_SERVICE_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalServiceEventCollection) Next() (*ExternalServiceEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalServiceEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalServiceEventClient) ById(id string) (*ExternalServiceEvent, error) { + resp := &ExternalServiceEvent{} + err := c.rancherClient.doById(EXTERNAL_SERVICE_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalServiceEventClient) Delete(container *ExternalServiceEvent) error { + return c.rancherClient.doResourceDelete(EXTERNAL_SERVICE_EVENT_TYPE, &container.Resource) +} + +func (c *ExternalServiceEventClient) ActionCreate(resource *ExternalServiceEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalServiceEventClient) ActionRemove(resource *ExternalServiceEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_SERVICE_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_storage_pool_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_storage_pool_event.go new file mode 100644 index 0000000000..30b8ca17d1 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_storage_pool_event.go @@ -0,0 +1,127 @@ +package client + +const ( + EXTERNAL_STORAGE_POOL_EVENT_TYPE = "externalStoragePoolEvent" +) + +type ExternalStoragePoolEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HostUuids []string `json:"hostUuids,omitempty" yaml:"host_uuids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedAccountId string `json:"reportedAccountId,omitempty" yaml:"reported_account_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StoragePool StoragePool `json:"storagePool,omitempty" yaml:"storage_pool,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ExternalStoragePoolEventCollection struct { + Collection + Data []ExternalStoragePoolEvent `json:"data,omitempty"` + client *ExternalStoragePoolEventClient +} + +type ExternalStoragePoolEventClient struct { + rancherClient *RancherClient +} + +type ExternalStoragePoolEventOperations interface { + List(opts *ListOpts) (*ExternalStoragePoolEventCollection, error) + Create(opts *ExternalStoragePoolEvent) (*ExternalStoragePoolEvent, error) + Update(existing *ExternalStoragePoolEvent, updates interface{}) (*ExternalStoragePoolEvent, error) + ById(id string) (*ExternalStoragePoolEvent, error) + Delete(container *ExternalStoragePoolEvent) error + + ActionCreate(*ExternalStoragePoolEvent) (*ExternalEvent, error) + + ActionRemove(*ExternalStoragePoolEvent) (*ExternalEvent, error) +} + +func newExternalStoragePoolEventClient(rancherClient *RancherClient) *ExternalStoragePoolEventClient { + return &ExternalStoragePoolEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalStoragePoolEventClient) Create(container *ExternalStoragePoolEvent) (*ExternalStoragePoolEvent, error) { + resp := &ExternalStoragePoolEvent{} + err := c.rancherClient.doCreate(EXTERNAL_STORAGE_POOL_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ExternalStoragePoolEventClient) Update(existing *ExternalStoragePoolEvent, updates interface{}) (*ExternalStoragePoolEvent, error) { + resp := &ExternalStoragePoolEvent{} + err := c.rancherClient.doUpdate(EXTERNAL_STORAGE_POOL_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalStoragePoolEventClient) List(opts *ListOpts) (*ExternalStoragePoolEventCollection, error) { + resp := &ExternalStoragePoolEventCollection{} + err := c.rancherClient.doList(EXTERNAL_STORAGE_POOL_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalStoragePoolEventCollection) Next() (*ExternalStoragePoolEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalStoragePoolEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalStoragePoolEventClient) ById(id string) (*ExternalStoragePoolEvent, error) { + resp := &ExternalStoragePoolEvent{} + err := c.rancherClient.doById(EXTERNAL_STORAGE_POOL_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalStoragePoolEventClient) Delete(container *ExternalStoragePoolEvent) error { + return c.rancherClient.doResourceDelete(EXTERNAL_STORAGE_POOL_EVENT_TYPE, &container.Resource) +} + +func (c *ExternalStoragePoolEventClient) ActionCreate(resource *ExternalStoragePoolEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_STORAGE_POOL_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalStoragePoolEventClient) ActionRemove(resource *ExternalStoragePoolEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_STORAGE_POOL_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_external_volume_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_external_volume_event.go new file mode 100644 index 0000000000..785efb1537 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_external_volume_event.go @@ -0,0 +1,125 @@ +package client + +const ( + EXTERNAL_VOLUME_EVENT_TYPE = "externalVolumeEvent" +) + +type ExternalVolumeEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + ReportedAccountId string `json:"reportedAccountId,omitempty" yaml:"reported_account_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Volume Volume `json:"volume,omitempty" yaml:"volume,omitempty"` +} + +type ExternalVolumeEventCollection struct { + Collection + Data []ExternalVolumeEvent `json:"data,omitempty"` + client *ExternalVolumeEventClient +} + +type ExternalVolumeEventClient struct { + rancherClient *RancherClient +} + +type ExternalVolumeEventOperations interface { + List(opts *ListOpts) (*ExternalVolumeEventCollection, error) + Create(opts *ExternalVolumeEvent) (*ExternalVolumeEvent, error) + Update(existing *ExternalVolumeEvent, updates interface{}) (*ExternalVolumeEvent, error) + ById(id string) (*ExternalVolumeEvent, error) + Delete(container *ExternalVolumeEvent) error + + ActionCreate(*ExternalVolumeEvent) (*ExternalEvent, error) + + ActionRemove(*ExternalVolumeEvent) (*ExternalEvent, error) +} + +func newExternalVolumeEventClient(rancherClient *RancherClient) *ExternalVolumeEventClient { + return &ExternalVolumeEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ExternalVolumeEventClient) Create(container *ExternalVolumeEvent) (*ExternalVolumeEvent, error) { + resp := &ExternalVolumeEvent{} + err := c.rancherClient.doCreate(EXTERNAL_VOLUME_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ExternalVolumeEventClient) Update(existing *ExternalVolumeEvent, updates interface{}) (*ExternalVolumeEvent, error) { + resp := &ExternalVolumeEvent{} + err := c.rancherClient.doUpdate(EXTERNAL_VOLUME_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ExternalVolumeEventClient) List(opts *ListOpts) (*ExternalVolumeEventCollection, error) { + resp := &ExternalVolumeEventCollection{} + err := c.rancherClient.doList(EXTERNAL_VOLUME_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ExternalVolumeEventCollection) Next() (*ExternalVolumeEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ExternalVolumeEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ExternalVolumeEventClient) ById(id string) (*ExternalVolumeEvent, error) { + resp := &ExternalVolumeEvent{} + err := c.rancherClient.doById(EXTERNAL_VOLUME_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ExternalVolumeEventClient) Delete(container *ExternalVolumeEvent) error { + return c.rancherClient.doResourceDelete(EXTERNAL_VOLUME_EVENT_TYPE, &container.Resource) +} + +func (c *ExternalVolumeEventClient) ActionCreate(resource *ExternalVolumeEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_VOLUME_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ExternalVolumeEventClient) ActionRemove(resource *ExternalVolumeEvent) (*ExternalEvent, error) { + + resp := &ExternalEvent{} + + err := c.rancherClient.doAction(EXTERNAL_VOLUME_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_field_documentation.go b/vendor/github.com/rancher/go-rancher/v2/generated_field_documentation.go new file mode 100644 index 0000000000..511d33becf --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_field_documentation.go @@ -0,0 +1,79 @@ +package client + +const ( + FIELD_DOCUMENTATION_TYPE = "fieldDocumentation" +) + +type FieldDocumentation struct { + Resource + + Description string `json:"description,omitempty" yaml:"description,omitempty"` +} + +type FieldDocumentationCollection struct { + Collection + Data []FieldDocumentation `json:"data,omitempty"` + client *FieldDocumentationClient +} + +type FieldDocumentationClient struct { + rancherClient *RancherClient +} + +type FieldDocumentationOperations interface { + List(opts *ListOpts) (*FieldDocumentationCollection, error) + Create(opts *FieldDocumentation) (*FieldDocumentation, error) + Update(existing *FieldDocumentation, updates interface{}) (*FieldDocumentation, error) + ById(id string) (*FieldDocumentation, error) + Delete(container *FieldDocumentation) error +} + +func newFieldDocumentationClient(rancherClient *RancherClient) *FieldDocumentationClient { + return &FieldDocumentationClient{ + rancherClient: rancherClient, + } +} + +func (c *FieldDocumentationClient) Create(container *FieldDocumentation) (*FieldDocumentation, error) { + resp := &FieldDocumentation{} + err := c.rancherClient.doCreate(FIELD_DOCUMENTATION_TYPE, container, resp) + return resp, err +} + +func (c *FieldDocumentationClient) Update(existing *FieldDocumentation, updates interface{}) (*FieldDocumentation, error) { + resp := &FieldDocumentation{} + err := c.rancherClient.doUpdate(FIELD_DOCUMENTATION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *FieldDocumentationClient) List(opts *ListOpts) (*FieldDocumentationCollection, error) { + resp := &FieldDocumentationCollection{} + err := c.rancherClient.doList(FIELD_DOCUMENTATION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *FieldDocumentationCollection) Next() (*FieldDocumentationCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &FieldDocumentationCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *FieldDocumentationClient) ById(id string) (*FieldDocumentation, error) { + resp := &FieldDocumentation{} + err := c.rancherClient.doById(FIELD_DOCUMENTATION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *FieldDocumentationClient) Delete(container *FieldDocumentation) error { + return c.rancherClient.doResourceDelete(FIELD_DOCUMENTATION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_generic_object.go b/vendor/github.com/rancher/go-rancher/v2/generated_generic_object.go new file mode 100644 index 0000000000..4cfd367b38 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_generic_object.go @@ -0,0 +1,129 @@ +package client + +const ( + GENERIC_OBJECT_TYPE = "genericObject" +) + +type GenericObject struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Key string `json:"key,omitempty" yaml:"key,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ResourceData map[string]interface{} `json:"resourceData,omitempty" yaml:"resource_data,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type GenericObjectCollection struct { + Collection + Data []GenericObject `json:"data,omitempty"` + client *GenericObjectClient +} + +type GenericObjectClient struct { + rancherClient *RancherClient +} + +type GenericObjectOperations interface { + List(opts *ListOpts) (*GenericObjectCollection, error) + Create(opts *GenericObject) (*GenericObject, error) + Update(existing *GenericObject, updates interface{}) (*GenericObject, error) + ById(id string) (*GenericObject, error) + Delete(container *GenericObject) error + + ActionCreate(*GenericObject) (*GenericObject, error) + + ActionRemove(*GenericObject) (*GenericObject, error) +} + +func newGenericObjectClient(rancherClient *RancherClient) *GenericObjectClient { + return &GenericObjectClient{ + rancherClient: rancherClient, + } +} + +func (c *GenericObjectClient) Create(container *GenericObject) (*GenericObject, error) { + resp := &GenericObject{} + err := c.rancherClient.doCreate(GENERIC_OBJECT_TYPE, container, resp) + return resp, err +} + +func (c *GenericObjectClient) Update(existing *GenericObject, updates interface{}) (*GenericObject, error) { + resp := &GenericObject{} + err := c.rancherClient.doUpdate(GENERIC_OBJECT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *GenericObjectClient) List(opts *ListOpts) (*GenericObjectCollection, error) { + resp := &GenericObjectCollection{} + err := c.rancherClient.doList(GENERIC_OBJECT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *GenericObjectCollection) Next() (*GenericObjectCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &GenericObjectCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *GenericObjectClient) ById(id string) (*GenericObject, error) { + resp := &GenericObject{} + err := c.rancherClient.doById(GENERIC_OBJECT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *GenericObjectClient) Delete(container *GenericObject) error { + return c.rancherClient.doResourceDelete(GENERIC_OBJECT_TYPE, &container.Resource) +} + +func (c *GenericObjectClient) ActionCreate(resource *GenericObject) (*GenericObject, error) { + + resp := &GenericObject{} + + err := c.rancherClient.doAction(GENERIC_OBJECT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *GenericObjectClient) ActionRemove(resource *GenericObject) (*GenericObject, error) { + + resp := &GenericObject{} + + err := c.rancherClient.doAction(GENERIC_OBJECT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_ha_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_ha_config.go new file mode 100644 index 0000000000..f5bb82f2c2 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_ha_config.go @@ -0,0 +1,85 @@ +package client + +const ( + HA_CONFIG_TYPE = "haConfig" +) + +type HaConfig struct { + Resource + + ClusterSize int64 `json:"clusterSize,omitempty" yaml:"cluster_size,omitempty"` + + DbHost string `json:"dbHost,omitempty" yaml:"db_host,omitempty"` + + DbSize int64 `json:"dbSize,omitempty" yaml:"db_size,omitempty"` + + Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` +} + +type HaConfigCollection struct { + Collection + Data []HaConfig `json:"data,omitempty"` + client *HaConfigClient +} + +type HaConfigClient struct { + rancherClient *RancherClient +} + +type HaConfigOperations interface { + List(opts *ListOpts) (*HaConfigCollection, error) + Create(opts *HaConfig) (*HaConfig, error) + Update(existing *HaConfig, updates interface{}) (*HaConfig, error) + ById(id string) (*HaConfig, error) + Delete(container *HaConfig) error +} + +func newHaConfigClient(rancherClient *RancherClient) *HaConfigClient { + return &HaConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *HaConfigClient) Create(container *HaConfig) (*HaConfig, error) { + resp := &HaConfig{} + err := c.rancherClient.doCreate(HA_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *HaConfigClient) Update(existing *HaConfig, updates interface{}) (*HaConfig, error) { + resp := &HaConfig{} + err := c.rancherClient.doUpdate(HA_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HaConfigClient) List(opts *ListOpts) (*HaConfigCollection, error) { + resp := &HaConfigCollection{} + err := c.rancherClient.doList(HA_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HaConfigCollection) Next() (*HaConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HaConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HaConfigClient) ById(id string) (*HaConfig, error) { + resp := &HaConfig{} + err := c.rancherClient.doById(HA_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HaConfigClient) Delete(container *HaConfig) error { + return c.rancherClient.doResourceDelete(HA_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_ha_config_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_ha_config_input.go new file mode 100644 index 0000000000..ce869369c0 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_ha_config_input.go @@ -0,0 +1,109 @@ +package client + +const ( + HA_CONFIG_INPUT_TYPE = "haConfigInput" +) + +type HaConfigInput struct { + Resource + + Cert string `json:"cert,omitempty" yaml:"cert,omitempty"` + + CertChain string `json:"certChain,omitempty" yaml:"cert_chain,omitempty"` + + ClusterSize int64 `json:"clusterSize,omitempty" yaml:"cluster_size,omitempty"` + + HostRegistrationUrl string `json:"hostRegistrationUrl,omitempty" yaml:"host_registration_url,omitempty"` + + HttpEnabled bool `json:"httpEnabled,omitempty" yaml:"http_enabled,omitempty"` + + HttpPort int64 `json:"httpPort,omitempty" yaml:"http_port,omitempty"` + + HttpsPort int64 `json:"httpsPort,omitempty" yaml:"https_port,omitempty"` + + Key string `json:"key,omitempty" yaml:"key,omitempty"` + + PpHttpPort int64 `json:"ppHttpPort,omitempty" yaml:"pp_http_port,omitempty"` + + PpHttpsPort int64 `json:"ppHttpsPort,omitempty" yaml:"pp_https_port,omitempty"` + + RedisPort int64 `json:"redisPort,omitempty" yaml:"redis_port,omitempty"` + + SwarmEnabled bool `json:"swarmEnabled,omitempty" yaml:"swarm_enabled,omitempty"` + + SwarmPort int64 `json:"swarmPort,omitempty" yaml:"swarm_port,omitempty"` + + ZookeeperClientPort int64 `json:"zookeeperClientPort,omitempty" yaml:"zookeeper_client_port,omitempty"` + + ZookeeperLeaderPort int64 `json:"zookeeperLeaderPort,omitempty" yaml:"zookeeper_leader_port,omitempty"` + + ZookeeperQuorumPort int64 `json:"zookeeperQuorumPort,omitempty" yaml:"zookeeper_quorum_port,omitempty"` +} + +type HaConfigInputCollection struct { + Collection + Data []HaConfigInput `json:"data,omitempty"` + client *HaConfigInputClient +} + +type HaConfigInputClient struct { + rancherClient *RancherClient +} + +type HaConfigInputOperations interface { + List(opts *ListOpts) (*HaConfigInputCollection, error) + Create(opts *HaConfigInput) (*HaConfigInput, error) + Update(existing *HaConfigInput, updates interface{}) (*HaConfigInput, error) + ById(id string) (*HaConfigInput, error) + Delete(container *HaConfigInput) error +} + +func newHaConfigInputClient(rancherClient *RancherClient) *HaConfigInputClient { + return &HaConfigInputClient{ + rancherClient: rancherClient, + } +} + +func (c *HaConfigInputClient) Create(container *HaConfigInput) (*HaConfigInput, error) { + resp := &HaConfigInput{} + err := c.rancherClient.doCreate(HA_CONFIG_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *HaConfigInputClient) Update(existing *HaConfigInput, updates interface{}) (*HaConfigInput, error) { + resp := &HaConfigInput{} + err := c.rancherClient.doUpdate(HA_CONFIG_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HaConfigInputClient) List(opts *ListOpts) (*HaConfigInputCollection, error) { + resp := &HaConfigInputCollection{} + err := c.rancherClient.doList(HA_CONFIG_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HaConfigInputCollection) Next() (*HaConfigInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HaConfigInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HaConfigInputClient) ById(id string) (*HaConfigInput, error) { + resp := &HaConfigInput{} + err := c.rancherClient.doById(HA_CONFIG_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HaConfigInputClient) Delete(container *HaConfigInput) error { + return c.rancherClient.doResourceDelete(HA_CONFIG_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_healthcheck_instance_host_map.go b/vendor/github.com/rancher/go-rancher/v2/generated_healthcheck_instance_host_map.go new file mode 100644 index 0000000000..b30b9d8692 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_healthcheck_instance_host_map.go @@ -0,0 +1,131 @@ +package client + +const ( + HEALTHCHECK_INSTANCE_HOST_MAP_TYPE = "healthcheckInstanceHostMap" +) + +type HealthcheckInstanceHostMap struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type HealthcheckInstanceHostMapCollection struct { + Collection + Data []HealthcheckInstanceHostMap `json:"data,omitempty"` + client *HealthcheckInstanceHostMapClient +} + +type HealthcheckInstanceHostMapClient struct { + rancherClient *RancherClient +} + +type HealthcheckInstanceHostMapOperations interface { + List(opts *ListOpts) (*HealthcheckInstanceHostMapCollection, error) + Create(opts *HealthcheckInstanceHostMap) (*HealthcheckInstanceHostMap, error) + Update(existing *HealthcheckInstanceHostMap, updates interface{}) (*HealthcheckInstanceHostMap, error) + ById(id string) (*HealthcheckInstanceHostMap, error) + Delete(container *HealthcheckInstanceHostMap) error + + ActionCreate(*HealthcheckInstanceHostMap) (*HealthcheckInstanceHostMap, error) + + ActionRemove(*HealthcheckInstanceHostMap) (*HealthcheckInstanceHostMap, error) +} + +func newHealthcheckInstanceHostMapClient(rancherClient *RancherClient) *HealthcheckInstanceHostMapClient { + return &HealthcheckInstanceHostMapClient{ + rancherClient: rancherClient, + } +} + +func (c *HealthcheckInstanceHostMapClient) Create(container *HealthcheckInstanceHostMap) (*HealthcheckInstanceHostMap, error) { + resp := &HealthcheckInstanceHostMap{} + err := c.rancherClient.doCreate(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, container, resp) + return resp, err +} + +func (c *HealthcheckInstanceHostMapClient) Update(existing *HealthcheckInstanceHostMap, updates interface{}) (*HealthcheckInstanceHostMap, error) { + resp := &HealthcheckInstanceHostMap{} + err := c.rancherClient.doUpdate(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HealthcheckInstanceHostMapClient) List(opts *ListOpts) (*HealthcheckInstanceHostMapCollection, error) { + resp := &HealthcheckInstanceHostMapCollection{} + err := c.rancherClient.doList(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HealthcheckInstanceHostMapCollection) Next() (*HealthcheckInstanceHostMapCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HealthcheckInstanceHostMapCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HealthcheckInstanceHostMapClient) ById(id string) (*HealthcheckInstanceHostMap, error) { + resp := &HealthcheckInstanceHostMap{} + err := c.rancherClient.doById(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HealthcheckInstanceHostMapClient) Delete(container *HealthcheckInstanceHostMap) error { + return c.rancherClient.doResourceDelete(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, &container.Resource) +} + +func (c *HealthcheckInstanceHostMapClient) ActionCreate(resource *HealthcheckInstanceHostMap) (*HealthcheckInstanceHostMap, error) { + + resp := &HealthcheckInstanceHostMap{} + + err := c.rancherClient.doAction(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HealthcheckInstanceHostMapClient) ActionRemove(resource *HealthcheckInstanceHostMap) (*HealthcheckInstanceHostMap, error) { + + resp := &HealthcheckInstanceHostMap{} + + err := c.rancherClient.doAction(HEALTHCHECK_INSTANCE_HOST_MAP_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_host.go b/vendor/github.com/rancher/go-rancher/v2/generated_host.go new file mode 100644 index 0000000000..801b330b9d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_host.go @@ -0,0 +1,275 @@ +package client + +const ( + HOST_TYPE = "host" +) + +type Host struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` + + AgentIpAddress string `json:"agentIpAddress,omitempty" yaml:"agent_ip_address,omitempty"` + + AgentState string `json:"agentState,omitempty" yaml:"agent_state,omitempty"` + + Amazonec2Config *Amazonec2Config `json:"amazonec2Config,omitempty" yaml:"amazonec2config,omitempty"` + + ApiProxy string `json:"apiProxy,omitempty" yaml:"api_proxy,omitempty"` + + AuthCertificateAuthority string `json:"authCertificateAuthority,omitempty" yaml:"auth_certificate_authority,omitempty"` + + AuthKey string `json:"authKey,omitempty" yaml:"auth_key,omitempty"` + + AzureConfig *AzureConfig `json:"azureConfig,omitempty" yaml:"azure_config,omitempty"` + + ComputeTotal int64 `json:"computeTotal,omitempty" yaml:"compute_total,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DigitaloceanConfig *DigitaloceanConfig `json:"digitaloceanConfig,omitempty" yaml:"digitalocean_config,omitempty"` + + DockerVersion string `json:"dockerVersion,omitempty" yaml:"docker_version,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + EngineEnv map[string]interface{} `json:"engineEnv,omitempty" yaml:"engine_env,omitempty"` + + EngineInsecureRegistry []string `json:"engineInsecureRegistry,omitempty" yaml:"engine_insecure_registry,omitempty"` + + EngineInstallUrl string `json:"engineInstallUrl,omitempty" yaml:"engine_install_url,omitempty"` + + EngineLabel map[string]interface{} `json:"engineLabel,omitempty" yaml:"engine_label,omitempty"` + + EngineOpt map[string]interface{} `json:"engineOpt,omitempty" yaml:"engine_opt,omitempty"` + + EngineRegistryMirror []string `json:"engineRegistryMirror,omitempty" yaml:"engine_registry_mirror,omitempty"` + + EngineStorageDriver string `json:"engineStorageDriver,omitempty" yaml:"engine_storage_driver,omitempty"` + + HostTemplateId string `json:"hostTemplateId,omitempty" yaml:"host_template_id,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + Info interface{} `json:"info,omitempty" yaml:"info,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + LocalStorageMb int64 `json:"localStorageMb,omitempty" yaml:"local_storage_mb,omitempty"` + + Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"` + + MilliCpu int64 `json:"milliCpu,omitempty" yaml:"milli_cpu,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PacketConfig *PacketConfig `json:"packetConfig,omitempty" yaml:"packet_config,omitempty"` + + PhysicalHostId string `json:"physicalHostId,omitempty" yaml:"physical_host_id,omitempty"` + + PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type HostCollection struct { + Collection + Data []Host `json:"data,omitempty"` + client *HostClient +} + +type HostClient struct { + rancherClient *RancherClient +} + +type HostOperations interface { + List(opts *ListOpts) (*HostCollection, error) + Create(opts *Host) (*Host, error) + Update(existing *Host, updates interface{}) (*Host, error) + ById(id string) (*Host, error) + Delete(container *Host) error + + ActionActivate(*Host) (*Host, error) + + ActionCreate(*Host) (*Host, error) + + ActionDeactivate(*Host) (*Host, error) + + ActionDockersocket(*Host) (*HostAccess, error) + + ActionError(*Host) (*Host, error) + + ActionEvacuate(*Host) (*Host, error) + + ActionProvision(*Host) (*Host, error) + + ActionPurge(*Host) (*Host, error) + + ActionRemove(*Host) (*Host, error) + + ActionUpdate(*Host) (*Host, error) +} + +func newHostClient(rancherClient *RancherClient) *HostClient { + return &HostClient{ + rancherClient: rancherClient, + } +} + +func (c *HostClient) Create(container *Host) (*Host, error) { + resp := &Host{} + err := c.rancherClient.doCreate(HOST_TYPE, container, resp) + return resp, err +} + +func (c *HostClient) Update(existing *Host, updates interface{}) (*Host, error) { + resp := &Host{} + err := c.rancherClient.doUpdate(HOST_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HostClient) List(opts *ListOpts) (*HostCollection, error) { + resp := &HostCollection{} + err := c.rancherClient.doList(HOST_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HostCollection) Next() (*HostCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HostCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HostClient) ById(id string) (*Host, error) { + resp := &Host{} + err := c.rancherClient.doById(HOST_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HostClient) Delete(container *Host) error { + return c.rancherClient.doResourceDelete(HOST_TYPE, &container.Resource) +} + +func (c *HostClient) ActionActivate(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionCreate(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionDeactivate(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionDockersocket(resource *Host) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(HOST_TYPE, "dockersocket", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionError(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionEvacuate(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "evacuate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionProvision(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "provision", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionPurge(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionRemove(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostClient) ActionUpdate(resource *Host) (*Host, error) { + + resp := &Host{} + + err := c.rancherClient.doAction(HOST_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_host_access.go b/vendor/github.com/rancher/go-rancher/v2/generated_host_access.go new file mode 100644 index 0000000000..7ebc586b52 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_host_access.go @@ -0,0 +1,81 @@ +package client + +const ( + HOST_ACCESS_TYPE = "hostAccess" +) + +type HostAccess struct { + Resource + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Url string `json:"url,omitempty" yaml:"url,omitempty"` +} + +type HostAccessCollection struct { + Collection + Data []HostAccess `json:"data,omitempty"` + client *HostAccessClient +} + +type HostAccessClient struct { + rancherClient *RancherClient +} + +type HostAccessOperations interface { + List(opts *ListOpts) (*HostAccessCollection, error) + Create(opts *HostAccess) (*HostAccess, error) + Update(existing *HostAccess, updates interface{}) (*HostAccess, error) + ById(id string) (*HostAccess, error) + Delete(container *HostAccess) error +} + +func newHostAccessClient(rancherClient *RancherClient) *HostAccessClient { + return &HostAccessClient{ + rancherClient: rancherClient, + } +} + +func (c *HostAccessClient) Create(container *HostAccess) (*HostAccess, error) { + resp := &HostAccess{} + err := c.rancherClient.doCreate(HOST_ACCESS_TYPE, container, resp) + return resp, err +} + +func (c *HostAccessClient) Update(existing *HostAccess, updates interface{}) (*HostAccess, error) { + resp := &HostAccess{} + err := c.rancherClient.doUpdate(HOST_ACCESS_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HostAccessClient) List(opts *ListOpts) (*HostAccessCollection, error) { + resp := &HostAccessCollection{} + err := c.rancherClient.doList(HOST_ACCESS_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HostAccessCollection) Next() (*HostAccessCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HostAccessCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HostAccessClient) ById(id string) (*HostAccess, error) { + resp := &HostAccess{} + err := c.rancherClient.doById(HOST_ACCESS_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HostAccessClient) Delete(container *HostAccess) error { + return c.rancherClient.doResourceDelete(HOST_ACCESS_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_host_api_proxy_token.go b/vendor/github.com/rancher/go-rancher/v2/generated_host_api_proxy_token.go new file mode 100644 index 0000000000..1517b79bf7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_host_api_proxy_token.go @@ -0,0 +1,83 @@ +package client + +const ( + HOST_API_PROXY_TOKEN_TYPE = "hostApiProxyToken" +) + +type HostApiProxyToken struct { + Resource + + ReportedUuid string `json:"reportedUuid,omitempty" yaml:"reported_uuid,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Url string `json:"url,omitempty" yaml:"url,omitempty"` +} + +type HostApiProxyTokenCollection struct { + Collection + Data []HostApiProxyToken `json:"data,omitempty"` + client *HostApiProxyTokenClient +} + +type HostApiProxyTokenClient struct { + rancherClient *RancherClient +} + +type HostApiProxyTokenOperations interface { + List(opts *ListOpts) (*HostApiProxyTokenCollection, error) + Create(opts *HostApiProxyToken) (*HostApiProxyToken, error) + Update(existing *HostApiProxyToken, updates interface{}) (*HostApiProxyToken, error) + ById(id string) (*HostApiProxyToken, error) + Delete(container *HostApiProxyToken) error +} + +func newHostApiProxyTokenClient(rancherClient *RancherClient) *HostApiProxyTokenClient { + return &HostApiProxyTokenClient{ + rancherClient: rancherClient, + } +} + +func (c *HostApiProxyTokenClient) Create(container *HostApiProxyToken) (*HostApiProxyToken, error) { + resp := &HostApiProxyToken{} + err := c.rancherClient.doCreate(HOST_API_PROXY_TOKEN_TYPE, container, resp) + return resp, err +} + +func (c *HostApiProxyTokenClient) Update(existing *HostApiProxyToken, updates interface{}) (*HostApiProxyToken, error) { + resp := &HostApiProxyToken{} + err := c.rancherClient.doUpdate(HOST_API_PROXY_TOKEN_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HostApiProxyTokenClient) List(opts *ListOpts) (*HostApiProxyTokenCollection, error) { + resp := &HostApiProxyTokenCollection{} + err := c.rancherClient.doList(HOST_API_PROXY_TOKEN_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HostApiProxyTokenCollection) Next() (*HostApiProxyTokenCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HostApiProxyTokenCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HostApiProxyTokenClient) ById(id string) (*HostApiProxyToken, error) { + resp := &HostApiProxyToken{} + err := c.rancherClient.doById(HOST_API_PROXY_TOKEN_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HostApiProxyTokenClient) Delete(container *HostApiProxyToken) error { + return c.rancherClient.doResourceDelete(HOST_API_PROXY_TOKEN_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_host_template.go b/vendor/github.com/rancher/go-rancher/v2/generated_host_template.go new file mode 100644 index 0000000000..42ec654ee7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_host_template.go @@ -0,0 +1,133 @@ +package client + +const ( + HOST_TEMPLATE_TYPE = "hostTemplate" +) + +type HostTemplate struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + FlavorPrefix string `json:"flavorPrefix,omitempty" yaml:"flavor_prefix,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicValues map[string]interface{} `json:"publicValues,omitempty" yaml:"public_values,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SecretValues map[string]interface{} `json:"secretValues,omitempty" yaml:"secret_values,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type HostTemplateCollection struct { + Collection + Data []HostTemplate `json:"data,omitempty"` + client *HostTemplateClient +} + +type HostTemplateClient struct { + rancherClient *RancherClient +} + +type HostTemplateOperations interface { + List(opts *ListOpts) (*HostTemplateCollection, error) + Create(opts *HostTemplate) (*HostTemplate, error) + Update(existing *HostTemplate, updates interface{}) (*HostTemplate, error) + ById(id string) (*HostTemplate, error) + Delete(container *HostTemplate) error + + ActionCreate(*HostTemplate) (*HostTemplate, error) + + ActionRemove(*HostTemplate) (*HostTemplate, error) +} + +func newHostTemplateClient(rancherClient *RancherClient) *HostTemplateClient { + return &HostTemplateClient{ + rancherClient: rancherClient, + } +} + +func (c *HostTemplateClient) Create(container *HostTemplate) (*HostTemplate, error) { + resp := &HostTemplate{} + err := c.rancherClient.doCreate(HOST_TEMPLATE_TYPE, container, resp) + return resp, err +} + +func (c *HostTemplateClient) Update(existing *HostTemplate, updates interface{}) (*HostTemplate, error) { + resp := &HostTemplate{} + err := c.rancherClient.doUpdate(HOST_TEMPLATE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *HostTemplateClient) List(opts *ListOpts) (*HostTemplateCollection, error) { + resp := &HostTemplateCollection{} + err := c.rancherClient.doList(HOST_TEMPLATE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *HostTemplateCollection) Next() (*HostTemplateCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &HostTemplateCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *HostTemplateClient) ById(id string) (*HostTemplate, error) { + resp := &HostTemplate{} + err := c.rancherClient.doById(HOST_TEMPLATE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *HostTemplateClient) Delete(container *HostTemplate) error { + return c.rancherClient.doResourceDelete(HOST_TEMPLATE_TYPE, &container.Resource) +} + +func (c *HostTemplateClient) ActionCreate(resource *HostTemplate) (*HostTemplate, error) { + + resp := &HostTemplate{} + + err := c.rancherClient.doAction(HOST_TEMPLATE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *HostTemplateClient) ActionRemove(resource *HostTemplate) (*HostTemplate, error) { + + resp := &HostTemplate{} + + err := c.rancherClient.doAction(HOST_TEMPLATE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_identity.go b/vendor/github.com/rancher/go-rancher/v2/generated_identity.go new file mode 100644 index 0000000000..1e5d1d3026 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_identity.go @@ -0,0 +1,97 @@ +package client + +const ( + IDENTITY_TYPE = "identity" +) + +type Identity struct { + Resource + + All string `json:"all,omitempty" yaml:"all,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExternalIdType string `json:"externalIdType,omitempty" yaml:"external_id_type,omitempty"` + + Login string `json:"login,omitempty" yaml:"login,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + ProfilePicture string `json:"profilePicture,omitempty" yaml:"profile_picture,omitempty"` + + ProfileUrl string `json:"profileUrl,omitempty" yaml:"profile_url,omitempty"` + + ProjectId string `json:"projectId,omitempty" yaml:"project_id,omitempty"` + + Role string `json:"role,omitempty" yaml:"role,omitempty"` + + User bool `json:"user,omitempty" yaml:"user,omitempty"` +} + +type IdentityCollection struct { + Collection + Data []Identity `json:"data,omitempty"` + client *IdentityClient +} + +type IdentityClient struct { + rancherClient *RancherClient +} + +type IdentityOperations interface { + List(opts *ListOpts) (*IdentityCollection, error) + Create(opts *Identity) (*Identity, error) + Update(existing *Identity, updates interface{}) (*Identity, error) + ById(id string) (*Identity, error) + Delete(container *Identity) error +} + +func newIdentityClient(rancherClient *RancherClient) *IdentityClient { + return &IdentityClient{ + rancherClient: rancherClient, + } +} + +func (c *IdentityClient) Create(container *Identity) (*Identity, error) { + resp := &Identity{} + err := c.rancherClient.doCreate(IDENTITY_TYPE, container, resp) + return resp, err +} + +func (c *IdentityClient) Update(existing *Identity, updates interface{}) (*Identity, error) { + resp := &Identity{} + err := c.rancherClient.doUpdate(IDENTITY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *IdentityClient) List(opts *ListOpts) (*IdentityCollection, error) { + resp := &IdentityCollection{} + err := c.rancherClient.doList(IDENTITY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *IdentityCollection) Next() (*IdentityCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &IdentityCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *IdentityClient) ById(id string) (*Identity, error) { + resp := &Identity{} + err := c.rancherClient.doById(IDENTITY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *IdentityClient) Delete(container *Identity) error { + return c.rancherClient.doResourceDelete(IDENTITY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_image.go b/vendor/github.com/rancher/go-rancher/v2/generated_image.go new file mode 100644 index 0000000000..2e0c02df10 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_image.go @@ -0,0 +1,169 @@ +package client + +const ( + IMAGE_TYPE = "image" +) + +type Image struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ImageCollection struct { + Collection + Data []Image `json:"data,omitempty"` + client *ImageClient +} + +type ImageClient struct { + rancherClient *RancherClient +} + +type ImageOperations interface { + List(opts *ListOpts) (*ImageCollection, error) + Create(opts *Image) (*Image, error) + Update(existing *Image, updates interface{}) (*Image, error) + ById(id string) (*Image, error) + Delete(container *Image) error + + ActionActivate(*Image) (*Image, error) + + ActionCreate(*Image) (*Image, error) + + ActionDeactivate(*Image) (*Image, error) + + ActionPurge(*Image) (*Image, error) + + ActionRemove(*Image) (*Image, error) + + ActionUpdate(*Image) (*Image, error) +} + +func newImageClient(rancherClient *RancherClient) *ImageClient { + return &ImageClient{ + rancherClient: rancherClient, + } +} + +func (c *ImageClient) Create(container *Image) (*Image, error) { + resp := &Image{} + err := c.rancherClient.doCreate(IMAGE_TYPE, container, resp) + return resp, err +} + +func (c *ImageClient) Update(existing *Image, updates interface{}) (*Image, error) { + resp := &Image{} + err := c.rancherClient.doUpdate(IMAGE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ImageClient) List(opts *ListOpts) (*ImageCollection, error) { + resp := &ImageCollection{} + err := c.rancherClient.doList(IMAGE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ImageCollection) Next() (*ImageCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ImageCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ImageClient) ById(id string) (*Image, error) { + resp := &Image{} + err := c.rancherClient.doById(IMAGE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ImageClient) Delete(container *Image) error { + return c.rancherClient.doResourceDelete(IMAGE_TYPE, &container.Resource) +} + +func (c *ImageClient) ActionActivate(resource *Image) (*Image, error) { + + resp := &Image{} + + err := c.rancherClient.doAction(IMAGE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ImageClient) ActionCreate(resource *Image) (*Image, error) { + + resp := &Image{} + + err := c.rancherClient.doAction(IMAGE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ImageClient) ActionDeactivate(resource *Image) (*Image, error) { + + resp := &Image{} + + err := c.rancherClient.doAction(IMAGE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ImageClient) ActionPurge(resource *Image) (*Image, error) { + + resp := &Image{} + + err := c.rancherClient.doAction(IMAGE_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ImageClient) ActionRemove(resource *Image) (*Image, error) { + + resp := &Image{} + + err := c.rancherClient.doAction(IMAGE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ImageClient) ActionUpdate(resource *Image) (*Image, error) { + + resp := &Image{} + + err := c.rancherClient.doAction(IMAGE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_in_service_upgrade_strategy.go b/vendor/github.com/rancher/go-rancher/v2/generated_in_service_upgrade_strategy.go new file mode 100644 index 0000000000..3e93a776b3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_in_service_upgrade_strategy.go @@ -0,0 +1,91 @@ +package client + +const ( + IN_SERVICE_UPGRADE_STRATEGY_TYPE = "inServiceUpgradeStrategy" +) + +type InServiceUpgradeStrategy struct { + Resource + + BatchSize int64 `json:"batchSize,omitempty" yaml:"batch_size,omitempty"` + + IntervalMillis int64 `json:"intervalMillis,omitempty" yaml:"interval_millis,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + PreviousLaunchConfig *LaunchConfig `json:"previousLaunchConfig,omitempty" yaml:"previous_launch_config,omitempty"` + + PreviousSecondaryLaunchConfigs []SecondaryLaunchConfig `json:"previousSecondaryLaunchConfigs,omitempty" yaml:"previous_secondary_launch_configs,omitempty"` + + SecondaryLaunchConfigs []SecondaryLaunchConfig `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"` + + StartFirst bool `json:"startFirst,omitempty" yaml:"start_first,omitempty"` +} + +type InServiceUpgradeStrategyCollection struct { + Collection + Data []InServiceUpgradeStrategy `json:"data,omitempty"` + client *InServiceUpgradeStrategyClient +} + +type InServiceUpgradeStrategyClient struct { + rancherClient *RancherClient +} + +type InServiceUpgradeStrategyOperations interface { + List(opts *ListOpts) (*InServiceUpgradeStrategyCollection, error) + Create(opts *InServiceUpgradeStrategy) (*InServiceUpgradeStrategy, error) + Update(existing *InServiceUpgradeStrategy, updates interface{}) (*InServiceUpgradeStrategy, error) + ById(id string) (*InServiceUpgradeStrategy, error) + Delete(container *InServiceUpgradeStrategy) error +} + +func newInServiceUpgradeStrategyClient(rancherClient *RancherClient) *InServiceUpgradeStrategyClient { + return &InServiceUpgradeStrategyClient{ + rancherClient: rancherClient, + } +} + +func (c *InServiceUpgradeStrategyClient) Create(container *InServiceUpgradeStrategy) (*InServiceUpgradeStrategy, error) { + resp := &InServiceUpgradeStrategy{} + err := c.rancherClient.doCreate(IN_SERVICE_UPGRADE_STRATEGY_TYPE, container, resp) + return resp, err +} + +func (c *InServiceUpgradeStrategyClient) Update(existing *InServiceUpgradeStrategy, updates interface{}) (*InServiceUpgradeStrategy, error) { + resp := &InServiceUpgradeStrategy{} + err := c.rancherClient.doUpdate(IN_SERVICE_UPGRADE_STRATEGY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InServiceUpgradeStrategyClient) List(opts *ListOpts) (*InServiceUpgradeStrategyCollection, error) { + resp := &InServiceUpgradeStrategyCollection{} + err := c.rancherClient.doList(IN_SERVICE_UPGRADE_STRATEGY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InServiceUpgradeStrategyCollection) Next() (*InServiceUpgradeStrategyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InServiceUpgradeStrategyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InServiceUpgradeStrategyClient) ById(id string) (*InServiceUpgradeStrategy, error) { + resp := &InServiceUpgradeStrategy{} + err := c.rancherClient.doById(IN_SERVICE_UPGRADE_STRATEGY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InServiceUpgradeStrategyClient) Delete(container *InServiceUpgradeStrategy) error { + return c.rancherClient.doResourceDelete(IN_SERVICE_UPGRADE_STRATEGY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_instance.go b/vendor/github.com/rancher/go-rancher/v2/generated_instance.go new file mode 100644 index 0000000000..cee9a2ea4d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_instance.go @@ -0,0 +1,272 @@ +package client + +const ( + INSTANCE_TYPE = "instance" +) + +type Instance struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type InstanceCollection struct { + Collection + Data []Instance `json:"data,omitempty"` + client *InstanceClient +} + +type InstanceClient struct { + rancherClient *RancherClient +} + +type InstanceOperations interface { + List(opts *ListOpts) (*InstanceCollection, error) + Create(opts *Instance) (*Instance, error) + Update(existing *Instance, updates interface{}) (*Instance, error) + ById(id string) (*Instance, error) + Delete(container *Instance) error + + ActionAllocate(*Instance) (*Instance, error) + + ActionConsole(*Instance, *InstanceConsoleInput) (*InstanceConsole, error) + + ActionCreate(*Instance) (*Instance, error) + + ActionDeallocate(*Instance) (*Instance, error) + + ActionError(*Instance) (*Instance, error) + + ActionMigrate(*Instance) (*Instance, error) + + ActionPurge(*Instance) (*Instance, error) + + ActionRemove(*Instance) (*Instance, error) + + ActionRestart(*Instance) (*Instance, error) + + ActionStart(*Instance) (*Instance, error) + + ActionStop(*Instance, *InstanceStop) (*Instance, error) + + ActionUpdate(*Instance) (*Instance, error) + + ActionUpdatehealthy(*Instance) (*Instance, error) + + ActionUpdatereinitializing(*Instance) (*Instance, error) + + ActionUpdateunhealthy(*Instance) (*Instance, error) +} + +func newInstanceClient(rancherClient *RancherClient) *InstanceClient { + return &InstanceClient{ + rancherClient: rancherClient, + } +} + +func (c *InstanceClient) Create(container *Instance) (*Instance, error) { + resp := &Instance{} + err := c.rancherClient.doCreate(INSTANCE_TYPE, container, resp) + return resp, err +} + +func (c *InstanceClient) Update(existing *Instance, updates interface{}) (*Instance, error) { + resp := &Instance{} + err := c.rancherClient.doUpdate(INSTANCE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InstanceClient) List(opts *ListOpts) (*InstanceCollection, error) { + resp := &InstanceCollection{} + err := c.rancherClient.doList(INSTANCE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InstanceCollection) Next() (*InstanceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InstanceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InstanceClient) ById(id string) (*Instance, error) { + resp := &Instance{} + err := c.rancherClient.doById(INSTANCE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InstanceClient) Delete(container *Instance) error { + return c.rancherClient.doResourceDelete(INSTANCE_TYPE, &container.Resource) +} + +func (c *InstanceClient) ActionAllocate(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "allocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionConsole(resource *Instance, input *InstanceConsoleInput) (*InstanceConsole, error) { + + resp := &InstanceConsole{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "console", &resource.Resource, input, resp) + + return resp, err +} + +func (c *InstanceClient) ActionCreate(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionDeallocate(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "deallocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionError(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionMigrate(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "migrate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionPurge(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionRemove(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionRestart(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "restart", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionStart(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "start", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionStop(resource *Instance, input *InstanceStop) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "stop", &resource.Resource, input, resp) + + return resp, err +} + +func (c *InstanceClient) ActionUpdate(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionUpdatehealthy(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "updatehealthy", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionUpdatereinitializing(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "updatereinitializing", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceClient) ActionUpdateunhealthy(resource *Instance) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(INSTANCE_TYPE, "updateunhealthy", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_instance_console.go b/vendor/github.com/rancher/go-rancher/v2/generated_instance_console.go new file mode 100644 index 0000000000..85746058d4 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_instance_console.go @@ -0,0 +1,83 @@ +package client + +const ( + INSTANCE_CONSOLE_TYPE = "instanceConsole" +) + +type InstanceConsole struct { + Resource + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Password string `json:"password,omitempty" yaml:"password,omitempty"` + + Url string `json:"url,omitempty" yaml:"url,omitempty"` +} + +type InstanceConsoleCollection struct { + Collection + Data []InstanceConsole `json:"data,omitempty"` + client *InstanceConsoleClient +} + +type InstanceConsoleClient struct { + rancherClient *RancherClient +} + +type InstanceConsoleOperations interface { + List(opts *ListOpts) (*InstanceConsoleCollection, error) + Create(opts *InstanceConsole) (*InstanceConsole, error) + Update(existing *InstanceConsole, updates interface{}) (*InstanceConsole, error) + ById(id string) (*InstanceConsole, error) + Delete(container *InstanceConsole) error +} + +func newInstanceConsoleClient(rancherClient *RancherClient) *InstanceConsoleClient { + return &InstanceConsoleClient{ + rancherClient: rancherClient, + } +} + +func (c *InstanceConsoleClient) Create(container *InstanceConsole) (*InstanceConsole, error) { + resp := &InstanceConsole{} + err := c.rancherClient.doCreate(INSTANCE_CONSOLE_TYPE, container, resp) + return resp, err +} + +func (c *InstanceConsoleClient) Update(existing *InstanceConsole, updates interface{}) (*InstanceConsole, error) { + resp := &InstanceConsole{} + err := c.rancherClient.doUpdate(INSTANCE_CONSOLE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InstanceConsoleClient) List(opts *ListOpts) (*InstanceConsoleCollection, error) { + resp := &InstanceConsoleCollection{} + err := c.rancherClient.doList(INSTANCE_CONSOLE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InstanceConsoleCollection) Next() (*InstanceConsoleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InstanceConsoleCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InstanceConsoleClient) ById(id string) (*InstanceConsole, error) { + resp := &InstanceConsole{} + err := c.rancherClient.doById(INSTANCE_CONSOLE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InstanceConsoleClient) Delete(container *InstanceConsole) error { + return c.rancherClient.doResourceDelete(INSTANCE_CONSOLE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_instance_console_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_instance_console_input.go new file mode 100644 index 0000000000..5bfbe81f2b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_instance_console_input.go @@ -0,0 +1,77 @@ +package client + +const ( + INSTANCE_CONSOLE_INPUT_TYPE = "instanceConsoleInput" +) + +type InstanceConsoleInput struct { + Resource +} + +type InstanceConsoleInputCollection struct { + Collection + Data []InstanceConsoleInput `json:"data,omitempty"` + client *InstanceConsoleInputClient +} + +type InstanceConsoleInputClient struct { + rancherClient *RancherClient +} + +type InstanceConsoleInputOperations interface { + List(opts *ListOpts) (*InstanceConsoleInputCollection, error) + Create(opts *InstanceConsoleInput) (*InstanceConsoleInput, error) + Update(existing *InstanceConsoleInput, updates interface{}) (*InstanceConsoleInput, error) + ById(id string) (*InstanceConsoleInput, error) + Delete(container *InstanceConsoleInput) error +} + +func newInstanceConsoleInputClient(rancherClient *RancherClient) *InstanceConsoleInputClient { + return &InstanceConsoleInputClient{ + rancherClient: rancherClient, + } +} + +func (c *InstanceConsoleInputClient) Create(container *InstanceConsoleInput) (*InstanceConsoleInput, error) { + resp := &InstanceConsoleInput{} + err := c.rancherClient.doCreate(INSTANCE_CONSOLE_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *InstanceConsoleInputClient) Update(existing *InstanceConsoleInput, updates interface{}) (*InstanceConsoleInput, error) { + resp := &InstanceConsoleInput{} + err := c.rancherClient.doUpdate(INSTANCE_CONSOLE_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InstanceConsoleInputClient) List(opts *ListOpts) (*InstanceConsoleInputCollection, error) { + resp := &InstanceConsoleInputCollection{} + err := c.rancherClient.doList(INSTANCE_CONSOLE_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InstanceConsoleInputCollection) Next() (*InstanceConsoleInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InstanceConsoleInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InstanceConsoleInputClient) ById(id string) (*InstanceConsoleInput, error) { + resp := &InstanceConsoleInput{} + err := c.rancherClient.doById(INSTANCE_CONSOLE_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InstanceConsoleInputClient) Delete(container *InstanceConsoleInput) error { + return c.rancherClient.doResourceDelete(INSTANCE_CONSOLE_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_instance_health_check.go b/vendor/github.com/rancher/go-rancher/v2/generated_instance_health_check.go new file mode 100644 index 0000000000..4f2ce46c41 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_instance_health_check.go @@ -0,0 +1,99 @@ +package client + +const ( + INSTANCE_HEALTH_CHECK_TYPE = "instanceHealthCheck" +) + +type InstanceHealthCheck struct { + Resource + + HealthyThreshold int64 `json:"healthyThreshold,omitempty" yaml:"healthy_threshold,omitempty"` + + InitializingTimeout int64 `json:"initializingTimeout,omitempty" yaml:"initializing_timeout,omitempty"` + + Interval int64 `json:"interval,omitempty" yaml:"interval,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + + RecreateOnQuorumStrategyConfig *RecreateOnQuorumStrategyConfig `json:"recreateOnQuorumStrategyConfig,omitempty" yaml:"recreate_on_quorum_strategy_config,omitempty"` + + ReinitializingTimeout int64 `json:"reinitializingTimeout,omitempty" yaml:"reinitializing_timeout,omitempty"` + + RequestLine string `json:"requestLine,omitempty" yaml:"request_line,omitempty"` + + ResponseTimeout int64 `json:"responseTimeout,omitempty" yaml:"response_timeout,omitempty"` + + Strategy string `json:"strategy,omitempty" yaml:"strategy,omitempty"` + + UnhealthyThreshold int64 `json:"unhealthyThreshold,omitempty" yaml:"unhealthy_threshold,omitempty"` +} + +type InstanceHealthCheckCollection struct { + Collection + Data []InstanceHealthCheck `json:"data,omitempty"` + client *InstanceHealthCheckClient +} + +type InstanceHealthCheckClient struct { + rancherClient *RancherClient +} + +type InstanceHealthCheckOperations interface { + List(opts *ListOpts) (*InstanceHealthCheckCollection, error) + Create(opts *InstanceHealthCheck) (*InstanceHealthCheck, error) + Update(existing *InstanceHealthCheck, updates interface{}) (*InstanceHealthCheck, error) + ById(id string) (*InstanceHealthCheck, error) + Delete(container *InstanceHealthCheck) error +} + +func newInstanceHealthCheckClient(rancherClient *RancherClient) *InstanceHealthCheckClient { + return &InstanceHealthCheckClient{ + rancherClient: rancherClient, + } +} + +func (c *InstanceHealthCheckClient) Create(container *InstanceHealthCheck) (*InstanceHealthCheck, error) { + resp := &InstanceHealthCheck{} + err := c.rancherClient.doCreate(INSTANCE_HEALTH_CHECK_TYPE, container, resp) + return resp, err +} + +func (c *InstanceHealthCheckClient) Update(existing *InstanceHealthCheck, updates interface{}) (*InstanceHealthCheck, error) { + resp := &InstanceHealthCheck{} + err := c.rancherClient.doUpdate(INSTANCE_HEALTH_CHECK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InstanceHealthCheckClient) List(opts *ListOpts) (*InstanceHealthCheckCollection, error) { + resp := &InstanceHealthCheckCollection{} + err := c.rancherClient.doList(INSTANCE_HEALTH_CHECK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InstanceHealthCheckCollection) Next() (*InstanceHealthCheckCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InstanceHealthCheckCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InstanceHealthCheckClient) ById(id string) (*InstanceHealthCheck, error) { + resp := &InstanceHealthCheck{} + err := c.rancherClient.doById(INSTANCE_HEALTH_CHECK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InstanceHealthCheckClient) Delete(container *InstanceHealthCheck) error { + return c.rancherClient.doResourceDelete(INSTANCE_HEALTH_CHECK_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_instance_link.go b/vendor/github.com/rancher/go-rancher/v2/generated_instance_link.go new file mode 100644 index 0000000000..4aa86e3b3c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_instance_link.go @@ -0,0 +1,177 @@ +package client + +const ( + INSTANCE_LINK_TYPE = "instanceLink" +) + +type InstanceLink struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LinkName string `json:"linkName,omitempty" yaml:"link_name,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Ports []interface{} `json:"ports,omitempty" yaml:"ports,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + TargetInstanceId string `json:"targetInstanceId,omitempty" yaml:"target_instance_id,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type InstanceLinkCollection struct { + Collection + Data []InstanceLink `json:"data,omitempty"` + client *InstanceLinkClient +} + +type InstanceLinkClient struct { + rancherClient *RancherClient +} + +type InstanceLinkOperations interface { + List(opts *ListOpts) (*InstanceLinkCollection, error) + Create(opts *InstanceLink) (*InstanceLink, error) + Update(existing *InstanceLink, updates interface{}) (*InstanceLink, error) + ById(id string) (*InstanceLink, error) + Delete(container *InstanceLink) error + + ActionActivate(*InstanceLink) (*InstanceLink, error) + + ActionCreate(*InstanceLink) (*InstanceLink, error) + + ActionDeactivate(*InstanceLink) (*InstanceLink, error) + + ActionPurge(*InstanceLink) (*InstanceLink, error) + + ActionRemove(*InstanceLink) (*InstanceLink, error) + + ActionUpdate(*InstanceLink) (*InstanceLink, error) +} + +func newInstanceLinkClient(rancherClient *RancherClient) *InstanceLinkClient { + return &InstanceLinkClient{ + rancherClient: rancherClient, + } +} + +func (c *InstanceLinkClient) Create(container *InstanceLink) (*InstanceLink, error) { + resp := &InstanceLink{} + err := c.rancherClient.doCreate(INSTANCE_LINK_TYPE, container, resp) + return resp, err +} + +func (c *InstanceLinkClient) Update(existing *InstanceLink, updates interface{}) (*InstanceLink, error) { + resp := &InstanceLink{} + err := c.rancherClient.doUpdate(INSTANCE_LINK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InstanceLinkClient) List(opts *ListOpts) (*InstanceLinkCollection, error) { + resp := &InstanceLinkCollection{} + err := c.rancherClient.doList(INSTANCE_LINK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InstanceLinkCollection) Next() (*InstanceLinkCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InstanceLinkCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InstanceLinkClient) ById(id string) (*InstanceLink, error) { + resp := &InstanceLink{} + err := c.rancherClient.doById(INSTANCE_LINK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InstanceLinkClient) Delete(container *InstanceLink) error { + return c.rancherClient.doResourceDelete(INSTANCE_LINK_TYPE, &container.Resource) +} + +func (c *InstanceLinkClient) ActionActivate(resource *InstanceLink) (*InstanceLink, error) { + + resp := &InstanceLink{} + + err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceLinkClient) ActionCreate(resource *InstanceLink) (*InstanceLink, error) { + + resp := &InstanceLink{} + + err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceLinkClient) ActionDeactivate(resource *InstanceLink) (*InstanceLink, error) { + + resp := &InstanceLink{} + + err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceLinkClient) ActionPurge(resource *InstanceLink) (*InstanceLink, error) { + + resp := &InstanceLink{} + + err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceLinkClient) ActionRemove(resource *InstanceLink) (*InstanceLink, error) { + + resp := &InstanceLink{} + + err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *InstanceLinkClient) ActionUpdate(resource *InstanceLink) (*InstanceLink, error) { + + resp := &InstanceLink{} + + err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_instance_stop.go b/vendor/github.com/rancher/go-rancher/v2/generated_instance_stop.go new file mode 100644 index 0000000000..2e3b2b67f7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_instance_stop.go @@ -0,0 +1,81 @@ +package client + +const ( + INSTANCE_STOP_TYPE = "instanceStop" +) + +type InstanceStop struct { + Resource + + Remove bool `json:"remove,omitempty" yaml:"remove,omitempty"` + + Timeout int64 `json:"timeout,omitempty" yaml:"timeout,omitempty"` +} + +type InstanceStopCollection struct { + Collection + Data []InstanceStop `json:"data,omitempty"` + client *InstanceStopClient +} + +type InstanceStopClient struct { + rancherClient *RancherClient +} + +type InstanceStopOperations interface { + List(opts *ListOpts) (*InstanceStopCollection, error) + Create(opts *InstanceStop) (*InstanceStop, error) + Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) + ById(id string) (*InstanceStop, error) + Delete(container *InstanceStop) error +} + +func newInstanceStopClient(rancherClient *RancherClient) *InstanceStopClient { + return &InstanceStopClient{ + rancherClient: rancherClient, + } +} + +func (c *InstanceStopClient) Create(container *InstanceStop) (*InstanceStop, error) { + resp := &InstanceStop{} + err := c.rancherClient.doCreate(INSTANCE_STOP_TYPE, container, resp) + return resp, err +} + +func (c *InstanceStopClient) Update(existing *InstanceStop, updates interface{}) (*InstanceStop, error) { + resp := &InstanceStop{} + err := c.rancherClient.doUpdate(INSTANCE_STOP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *InstanceStopClient) List(opts *ListOpts) (*InstanceStopCollection, error) { + resp := &InstanceStopCollection{} + err := c.rancherClient.doList(INSTANCE_STOP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *InstanceStopCollection) Next() (*InstanceStopCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &InstanceStopCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *InstanceStopClient) ById(id string) (*InstanceStop, error) { + resp := &InstanceStop{} + err := c.rancherClient.doById(INSTANCE_STOP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *InstanceStopClient) Delete(container *InstanceStop) error { + return c.rancherClient.doResourceDelete(INSTANCE_STOP_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_ip_address.go b/vendor/github.com/rancher/go-rancher/v2/generated_ip_address.go new file mode 100644 index 0000000000..a41d2c7573 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_ip_address.go @@ -0,0 +1,195 @@ +package client + +const ( + IP_ADDRESS_TYPE = "ipAddress" +) + +type IpAddress struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Address string `json:"address,omitempty" yaml:"address,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NetworkId string `json:"networkId,omitempty" yaml:"network_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type IpAddressCollection struct { + Collection + Data []IpAddress `json:"data,omitempty"` + client *IpAddressClient +} + +type IpAddressClient struct { + rancherClient *RancherClient +} + +type IpAddressOperations interface { + List(opts *ListOpts) (*IpAddressCollection, error) + Create(opts *IpAddress) (*IpAddress, error) + Update(existing *IpAddress, updates interface{}) (*IpAddress, error) + ById(id string) (*IpAddress, error) + Delete(container *IpAddress) error + + ActionActivate(*IpAddress) (*IpAddress, error) + + ActionAssociate(*IpAddress) (*IpAddress, error) + + ActionCreate(*IpAddress) (*IpAddress, error) + + ActionDeactivate(*IpAddress) (*IpAddress, error) + + ActionDisassociate(*IpAddress) (*IpAddress, error) + + ActionPurge(*IpAddress) (*IpAddress, error) + + ActionRemove(*IpAddress) (*IpAddress, error) + + ActionUpdate(*IpAddress) (*IpAddress, error) +} + +func newIpAddressClient(rancherClient *RancherClient) *IpAddressClient { + return &IpAddressClient{ + rancherClient: rancherClient, + } +} + +func (c *IpAddressClient) Create(container *IpAddress) (*IpAddress, error) { + resp := &IpAddress{} + err := c.rancherClient.doCreate(IP_ADDRESS_TYPE, container, resp) + return resp, err +} + +func (c *IpAddressClient) Update(existing *IpAddress, updates interface{}) (*IpAddress, error) { + resp := &IpAddress{} + err := c.rancherClient.doUpdate(IP_ADDRESS_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *IpAddressClient) List(opts *ListOpts) (*IpAddressCollection, error) { + resp := &IpAddressCollection{} + err := c.rancherClient.doList(IP_ADDRESS_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *IpAddressCollection) Next() (*IpAddressCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &IpAddressCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *IpAddressClient) ById(id string) (*IpAddress, error) { + resp := &IpAddress{} + err := c.rancherClient.doById(IP_ADDRESS_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *IpAddressClient) Delete(container *IpAddress) error { + return c.rancherClient.doResourceDelete(IP_ADDRESS_TYPE, &container.Resource) +} + +func (c *IpAddressClient) ActionActivate(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionAssociate(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "associate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionCreate(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionDeactivate(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionDisassociate(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "disassociate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionPurge(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionRemove(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *IpAddressClient) ActionUpdate(resource *IpAddress) (*IpAddress, error) { + + resp := &IpAddress{} + + err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_service.go new file mode 100644 index 0000000000..15fa378042 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_service.go @@ -0,0 +1,275 @@ +package client + +const ( + KUBERNETES_SERVICE_TYPE = "kubernetesService" +) + +type KubernetesService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Template interface{} `json:"template,omitempty" yaml:"template,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vip string `json:"vip,omitempty" yaml:"vip,omitempty"` +} + +type KubernetesServiceCollection struct { + Collection + Data []KubernetesService `json:"data,omitempty"` + client *KubernetesServiceClient +} + +type KubernetesServiceClient struct { + rancherClient *RancherClient +} + +type KubernetesServiceOperations interface { + List(opts *ListOpts) (*KubernetesServiceCollection, error) + Create(opts *KubernetesService) (*KubernetesService, error) + Update(existing *KubernetesService, updates interface{}) (*KubernetesService, error) + ById(id string) (*KubernetesService, error) + Delete(container *KubernetesService) error + + ActionActivate(*KubernetesService) (*Service, error) + + ActionAddservicelink(*KubernetesService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionCancelupgrade(*KubernetesService) (*Service, error) + + ActionContinueupgrade(*KubernetesService) (*Service, error) + + ActionCreate(*KubernetesService) (*Service, error) + + ActionDeactivate(*KubernetesService) (*Service, error) + + ActionFinishupgrade(*KubernetesService) (*Service, error) + + ActionRemove(*KubernetesService) (*Service, error) + + ActionRemoveservicelink(*KubernetesService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionRestart(*KubernetesService, *ServiceRestart) (*Service, error) + + ActionRollback(*KubernetesService) (*Service, error) + + ActionSetservicelinks(*KubernetesService, *SetServiceLinksInput) (*Service, error) + + ActionUpdate(*KubernetesService) (*Service, error) + + ActionUpgrade(*KubernetesService, *ServiceUpgrade) (*Service, error) +} + +func newKubernetesServiceClient(rancherClient *RancherClient) *KubernetesServiceClient { + return &KubernetesServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *KubernetesServiceClient) Create(container *KubernetesService) (*KubernetesService, error) { + resp := &KubernetesService{} + err := c.rancherClient.doCreate(KUBERNETES_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *KubernetesServiceClient) Update(existing *KubernetesService, updates interface{}) (*KubernetesService, error) { + resp := &KubernetesService{} + err := c.rancherClient.doUpdate(KUBERNETES_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *KubernetesServiceClient) List(opts *ListOpts) (*KubernetesServiceCollection, error) { + resp := &KubernetesServiceCollection{} + err := c.rancherClient.doList(KUBERNETES_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *KubernetesServiceCollection) Next() (*KubernetesServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &KubernetesServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *KubernetesServiceClient) ById(id string) (*KubernetesService, error) { + resp := &KubernetesService{} + err := c.rancherClient.doById(KUBERNETES_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *KubernetesServiceClient) Delete(container *KubernetesService) error { + return c.rancherClient.doResourceDelete(KUBERNETES_SERVICE_TYPE, &container.Resource) +} + +func (c *KubernetesServiceClient) ActionActivate(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionAddservicelink(resource *KubernetesService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionCancelupgrade(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionContinueupgrade(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionCreate(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionDeactivate(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionFinishupgrade(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionRemove(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionRemoveservicelink(resource *KubernetesService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionRestart(resource *KubernetesService, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionRollback(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionSetservicelinks(resource *KubernetesService, input *SetServiceLinksInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionUpdate(resource *KubernetesService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesServiceClient) ActionUpgrade(resource *KubernetesService, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack.go b/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack.go new file mode 100644 index 0000000000..ef8eaa3bb7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack.go @@ -0,0 +1,204 @@ +package client + +const ( + KUBERNETES_STACK_TYPE = "kubernetesStack" +) + +type KubernetesStack struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"` + + Binding *Binding `json:"binding,omitempty" yaml:"binding,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Group string `json:"group,omitempty" yaml:"group,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` + + PreviousEnvironment map[string]interface{} `json:"previousEnvironment,omitempty" yaml:"previous_environment,omitempty"` + + PreviousExternalId string `json:"previousExternalId,omitempty" yaml:"previous_external_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type KubernetesStackCollection struct { + Collection + Data []KubernetesStack `json:"data,omitempty"` + client *KubernetesStackClient +} + +type KubernetesStackClient struct { + rancherClient *RancherClient +} + +type KubernetesStackOperations interface { + List(opts *ListOpts) (*KubernetesStackCollection, error) + Create(opts *KubernetesStack) (*KubernetesStack, error) + Update(existing *KubernetesStack, updates interface{}) (*KubernetesStack, error) + ById(id string) (*KubernetesStack, error) + Delete(container *KubernetesStack) error + + ActionCancelupgrade(*KubernetesStack) (*Stack, error) + + ActionCreate(*KubernetesStack) (*Stack, error) + + ActionError(*KubernetesStack) (*Stack, error) + + ActionFinishupgrade(*KubernetesStack) (*Stack, error) + + ActionRemove(*KubernetesStack) (*Stack, error) + + ActionRollback(*KubernetesStack) (*Stack, error) + + ActionUpgrade(*KubernetesStack, *KubernetesStackUpgrade) (*KubernetesStack, error) +} + +func newKubernetesStackClient(rancherClient *RancherClient) *KubernetesStackClient { + return &KubernetesStackClient{ + rancherClient: rancherClient, + } +} + +func (c *KubernetesStackClient) Create(container *KubernetesStack) (*KubernetesStack, error) { + resp := &KubernetesStack{} + err := c.rancherClient.doCreate(KUBERNETES_STACK_TYPE, container, resp) + return resp, err +} + +func (c *KubernetesStackClient) Update(existing *KubernetesStack, updates interface{}) (*KubernetesStack, error) { + resp := &KubernetesStack{} + err := c.rancherClient.doUpdate(KUBERNETES_STACK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *KubernetesStackClient) List(opts *ListOpts) (*KubernetesStackCollection, error) { + resp := &KubernetesStackCollection{} + err := c.rancherClient.doList(KUBERNETES_STACK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *KubernetesStackCollection) Next() (*KubernetesStackCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &KubernetesStackCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *KubernetesStackClient) ById(id string) (*KubernetesStack, error) { + resp := &KubernetesStack{} + err := c.rancherClient.doById(KUBERNETES_STACK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *KubernetesStackClient) Delete(container *KubernetesStack) error { + return c.rancherClient.doResourceDelete(KUBERNETES_STACK_TYPE, &container.Resource) +} + +func (c *KubernetesStackClient) ActionCancelupgrade(resource *KubernetesStack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesStackClient) ActionCreate(resource *KubernetesStack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesStackClient) ActionError(resource *KubernetesStack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesStackClient) ActionFinishupgrade(resource *KubernetesStack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesStackClient) ActionRemove(resource *KubernetesStack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesStackClient) ActionRollback(resource *KubernetesStack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *KubernetesStackClient) ActionUpgrade(resource *KubernetesStack, input *KubernetesStackUpgrade) (*KubernetesStack, error) { + + resp := &KubernetesStack{} + + err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack_upgrade.go b/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack_upgrade.go new file mode 100644 index 0000000000..793b10ede5 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_kubernetes_stack_upgrade.go @@ -0,0 +1,85 @@ +package client + +const ( + KUBERNETES_STACK_UPGRADE_TYPE = "kubernetesStackUpgrade" +) + +type KubernetesStackUpgrade struct { + Resource + + Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"` +} + +type KubernetesStackUpgradeCollection struct { + Collection + Data []KubernetesStackUpgrade `json:"data,omitempty"` + client *KubernetesStackUpgradeClient +} + +type KubernetesStackUpgradeClient struct { + rancherClient *RancherClient +} + +type KubernetesStackUpgradeOperations interface { + List(opts *ListOpts) (*KubernetesStackUpgradeCollection, error) + Create(opts *KubernetesStackUpgrade) (*KubernetesStackUpgrade, error) + Update(existing *KubernetesStackUpgrade, updates interface{}) (*KubernetesStackUpgrade, error) + ById(id string) (*KubernetesStackUpgrade, error) + Delete(container *KubernetesStackUpgrade) error +} + +func newKubernetesStackUpgradeClient(rancherClient *RancherClient) *KubernetesStackUpgradeClient { + return &KubernetesStackUpgradeClient{ + rancherClient: rancherClient, + } +} + +func (c *KubernetesStackUpgradeClient) Create(container *KubernetesStackUpgrade) (*KubernetesStackUpgrade, error) { + resp := &KubernetesStackUpgrade{} + err := c.rancherClient.doCreate(KUBERNETES_STACK_UPGRADE_TYPE, container, resp) + return resp, err +} + +func (c *KubernetesStackUpgradeClient) Update(existing *KubernetesStackUpgrade, updates interface{}) (*KubernetesStackUpgrade, error) { + resp := &KubernetesStackUpgrade{} + err := c.rancherClient.doUpdate(KUBERNETES_STACK_UPGRADE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *KubernetesStackUpgradeClient) List(opts *ListOpts) (*KubernetesStackUpgradeCollection, error) { + resp := &KubernetesStackUpgradeCollection{} + err := c.rancherClient.doList(KUBERNETES_STACK_UPGRADE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *KubernetesStackUpgradeCollection) Next() (*KubernetesStackUpgradeCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &KubernetesStackUpgradeCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *KubernetesStackUpgradeClient) ById(id string) (*KubernetesStackUpgrade, error) { + resp := &KubernetesStackUpgrade{} + err := c.rancherClient.doById(KUBERNETES_STACK_UPGRADE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *KubernetesStackUpgradeClient) Delete(container *KubernetesStackUpgrade) error { + return c.rancherClient.doResourceDelete(KUBERNETES_STACK_UPGRADE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_label.go b/vendor/github.com/rancher/go-rancher/v2/generated_label.go new file mode 100644 index 0000000000..6b67a2e84b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_label.go @@ -0,0 +1,129 @@ +package client + +const ( + LABEL_TYPE = "label" +) + +type Label struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Key string `json:"key,omitempty" yaml:"key,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type LabelCollection struct { + Collection + Data []Label `json:"data,omitempty"` + client *LabelClient +} + +type LabelClient struct { + rancherClient *RancherClient +} + +type LabelOperations interface { + List(opts *ListOpts) (*LabelCollection, error) + Create(opts *Label) (*Label, error) + Update(existing *Label, updates interface{}) (*Label, error) + ById(id string) (*Label, error) + Delete(container *Label) error + + ActionCreate(*Label) (*Label, error) + + ActionRemove(*Label) (*Label, error) +} + +func newLabelClient(rancherClient *RancherClient) *LabelClient { + return &LabelClient{ + rancherClient: rancherClient, + } +} + +func (c *LabelClient) Create(container *Label) (*Label, error) { + resp := &Label{} + err := c.rancherClient.doCreate(LABEL_TYPE, container, resp) + return resp, err +} + +func (c *LabelClient) Update(existing *Label, updates interface{}) (*Label, error) { + resp := &Label{} + err := c.rancherClient.doUpdate(LABEL_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LabelClient) List(opts *ListOpts) (*LabelCollection, error) { + resp := &LabelCollection{} + err := c.rancherClient.doList(LABEL_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LabelCollection) Next() (*LabelCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LabelCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LabelClient) ById(id string) (*Label, error) { + resp := &Label{} + err := c.rancherClient.doById(LABEL_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LabelClient) Delete(container *Label) error { + return c.rancherClient.doResourceDelete(LABEL_TYPE, &container.Resource) +} + +func (c *LabelClient) ActionCreate(resource *Label) (*Label, error) { + + resp := &Label{} + + err := c.rancherClient.doAction(LABEL_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LabelClient) ActionRemove(resource *Label) (*Label, error) { + + resp := &Label{} + + err := c.rancherClient.doAction(LABEL_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_launch_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_launch_config.go new file mode 100644 index 0000000000..adbb6b1b57 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_launch_config.go @@ -0,0 +1,518 @@ +package client + +const ( + LAUNCH_CONFIG_TYPE = "launchConfig" +) + +type LaunchConfig struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` + + AllocationState string `json:"allocationState,omitempty" yaml:"allocation_state,omitempty"` + + BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"` + + BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"` + + Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"` + + CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"` + + CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,omitempty"` + + CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"` + + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + + Count int64 `json:"count,omitempty" yaml:"count,omitempty"` + + CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"` + + CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"` + + CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"` + + CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"` + + CpuRealtimePeriod int64 `json:"cpuRealtimePeriod,omitempty" yaml:"cpu_realtime_period,omitempty"` + + CpuRealtimeRuntime int64 `json:"cpuRealtimeRuntime,omitempty" yaml:"cpu_realtime_runtime,omitempty"` + + CpuSet string `json:"cpuSet,omitempty" yaml:"cpu_set,omitempty"` + + CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"` + + CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DataVolumeMounts map[string]interface{} `json:"dataVolumeMounts,omitempty" yaml:"data_volume_mounts,omitempty"` + + DataVolumes []string `json:"dataVolumes,omitempty" yaml:"data_volumes,omitempty"` + + DataVolumesFrom []string `json:"dataVolumesFrom,omitempty" yaml:"data_volumes_from,omitempty"` + + DataVolumesFromLaunchConfigs []string `json:"dataVolumesFromLaunchConfigs,omitempty" yaml:"data_volumes_from_launch_configs,omitempty"` + + DeploymentUnitUuid string `json:"deploymentUnitUuid,omitempty" yaml:"deployment_unit_uuid,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Devices []string `json:"devices,omitempty" yaml:"devices,omitempty"` + + DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"` + + Disks []VirtualMachineDisk `json:"disks,omitempty" yaml:"disks,omitempty"` + + Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"` + + DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"` + + DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"` + + DrainTimeoutMs int64 `json:"drainTimeoutMs,omitempty" yaml:"drain_timeout_ms,omitempty"` + + EntryPoint []string `json:"entryPoint,omitempty" yaml:"entry_point,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + Expose []string `json:"expose,omitempty" yaml:"expose,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExtraHosts []string `json:"extraHosts,omitempty" yaml:"extra_hosts,omitempty"` + + FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"` + + GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"` + + HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"` + + HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"` + + HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"` + + HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + ImageUuid string `json:"imageUuid,omitempty" yaml:"image_uuid,omitempty"` + + InstanceLinks map[string]interface{} `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"` + + InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"` + + IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"` + + IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"` + + Ip string `json:"ip,omitempty" yaml:"ip,omitempty"` + + Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"` + + IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"` + + Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"` + + KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + LogConfig *LogConfig `json:"logConfig,omitempty" yaml:"log_config,omitempty"` + + LxcConf map[string]interface{} `json:"lxcConf,omitempty" yaml:"lxc_conf,omitempty"` + + Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"` + + MemoryMb int64 `json:"memoryMb,omitempty" yaml:"memory_mb,omitempty"` + + MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"` + + MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"` + + MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"` + + MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"` + + Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"` + + NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"` + + NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"` + + NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"` + + NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"` + + NetworkLaunchConfig string `json:"networkLaunchConfig,omitempty" yaml:"network_launch_config,omitempty"` + + NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"` + + OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"` + + OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"` + + PidMode string `json:"pidMode,omitempty" yaml:"pid_mode,omitempty"` + + PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + + PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"` + + PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"` + + Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` + + PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,omitempty"` + + ReadOnly bool `json:"readOnly,omitempty" yaml:"read_only,omitempty"` + + RegistryCredentialId string `json:"registryCredentialId,omitempty" yaml:"registry_credential_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RequestedHostId string `json:"requestedHostId,omitempty" yaml:"requested_host_id,omitempty"` + + RequestedIpAddress string `json:"requestedIpAddress,omitempty" yaml:"requested_ip_address,omitempty"` + + RunInit bool `json:"runInit,omitempty" yaml:"run_init,omitempty"` + + Secrets []SecretReference `json:"secrets,omitempty" yaml:"secrets,omitempty"` + + SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StdinOpen bool `json:"stdinOpen,omitempty" yaml:"stdin_open,omitempty"` + + StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"` + + StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"` + + StorageOpt map[string]interface{} `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"` + + Sysctls map[string]interface{} `json:"sysctls,omitempty" yaml:"sysctls,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Tmpfs map[string]interface{} `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` + + Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` + + User string `json:"user,omitempty" yaml:"user,omitempty"` + + UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"` + + Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"` + + UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"` + + Uts string `json:"uts,omitempty" yaml:"uts,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vcpu int64 `json:"vcpu,omitempty" yaml:"vcpu,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` + + VolumeDriver string `json:"volumeDriver,omitempty" yaml:"volume_driver,omitempty"` + + WorkingDir string `json:"workingDir,omitempty" yaml:"working_dir,omitempty"` +} + +type LaunchConfigCollection struct { + Collection + Data []LaunchConfig `json:"data,omitempty"` + client *LaunchConfigClient +} + +type LaunchConfigClient struct { + rancherClient *RancherClient +} + +type LaunchConfigOperations interface { + List(opts *ListOpts) (*LaunchConfigCollection, error) + Create(opts *LaunchConfig) (*LaunchConfig, error) + Update(existing *LaunchConfig, updates interface{}) (*LaunchConfig, error) + ById(id string) (*LaunchConfig, error) + Delete(container *LaunchConfig) error + + ActionAllocate(*LaunchConfig) (*Instance, error) + + ActionConsole(*LaunchConfig, *InstanceConsoleInput) (*InstanceConsole, error) + + ActionCreate(*LaunchConfig) (*Instance, error) + + ActionDeallocate(*LaunchConfig) (*Instance, error) + + ActionError(*LaunchConfig) (*Instance, error) + + ActionExecute(*LaunchConfig, *ContainerExec) (*HostAccess, error) + + ActionMigrate(*LaunchConfig) (*Instance, error) + + ActionProxy(*LaunchConfig, *ContainerProxy) (*HostAccess, error) + + ActionPurge(*LaunchConfig) (*Instance, error) + + ActionRemove(*LaunchConfig) (*Instance, error) + + ActionRestart(*LaunchConfig) (*Instance, error) + + ActionStart(*LaunchConfig) (*Instance, error) + + ActionStop(*LaunchConfig, *InstanceStop) (*Instance, error) + + ActionUpdate(*LaunchConfig) (*Instance, error) + + ActionUpdatehealthy(*LaunchConfig) (*Instance, error) + + ActionUpdatereinitializing(*LaunchConfig) (*Instance, error) + + ActionUpdateunhealthy(*LaunchConfig) (*Instance, error) +} + +func newLaunchConfigClient(rancherClient *RancherClient) *LaunchConfigClient { + return &LaunchConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *LaunchConfigClient) Create(container *LaunchConfig) (*LaunchConfig, error) { + resp := &LaunchConfig{} + err := c.rancherClient.doCreate(LAUNCH_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *LaunchConfigClient) Update(existing *LaunchConfig, updates interface{}) (*LaunchConfig, error) { + resp := &LaunchConfig{} + err := c.rancherClient.doUpdate(LAUNCH_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LaunchConfigClient) List(opts *ListOpts) (*LaunchConfigCollection, error) { + resp := &LaunchConfigCollection{} + err := c.rancherClient.doList(LAUNCH_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LaunchConfigCollection) Next() (*LaunchConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LaunchConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LaunchConfigClient) ById(id string) (*LaunchConfig, error) { + resp := &LaunchConfig{} + err := c.rancherClient.doById(LAUNCH_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LaunchConfigClient) Delete(container *LaunchConfig) error { + return c.rancherClient.doResourceDelete(LAUNCH_CONFIG_TYPE, &container.Resource) +} + +func (c *LaunchConfigClient) ActionAllocate(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "allocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionConsole(resource *LaunchConfig, input *InstanceConsoleInput) (*InstanceConsole, error) { + + resp := &InstanceConsole{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "console", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionCreate(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionDeallocate(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "deallocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionError(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionExecute(resource *LaunchConfig, input *ContainerExec) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "execute", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionMigrate(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "migrate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionProxy(resource *LaunchConfig, input *ContainerProxy) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "proxy", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionPurge(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionRemove(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionRestart(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "restart", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionStart(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "start", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionStop(resource *LaunchConfig, input *InstanceStop) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "stop", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionUpdate(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionUpdatehealthy(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "updatehealthy", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionUpdatereinitializing(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "updatereinitializing", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LaunchConfigClient) ActionUpdateunhealthy(resource *LaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "updateunhealthy", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_lb_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_lb_config.go new file mode 100644 index 0000000000..80edbdf78d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_lb_config.go @@ -0,0 +1,87 @@ +package client + +const ( + LB_CONFIG_TYPE = "lbConfig" +) + +type LbConfig struct { + Resource + + CertificateIds []string `json:"certificateIds,omitempty" yaml:"certificate_ids,omitempty"` + + Config string `json:"config,omitempty" yaml:"config,omitempty"` + + DefaultCertificateId string `json:"defaultCertificateId,omitempty" yaml:"default_certificate_id,omitempty"` + + PortRules []PortRule `json:"portRules,omitempty" yaml:"port_rules,omitempty"` + + StickinessPolicy *LoadBalancerCookieStickinessPolicy `json:"stickinessPolicy,omitempty" yaml:"stickiness_policy,omitempty"` +} + +type LbConfigCollection struct { + Collection + Data []LbConfig `json:"data,omitempty"` + client *LbConfigClient +} + +type LbConfigClient struct { + rancherClient *RancherClient +} + +type LbConfigOperations interface { + List(opts *ListOpts) (*LbConfigCollection, error) + Create(opts *LbConfig) (*LbConfig, error) + Update(existing *LbConfig, updates interface{}) (*LbConfig, error) + ById(id string) (*LbConfig, error) + Delete(container *LbConfig) error +} + +func newLbConfigClient(rancherClient *RancherClient) *LbConfigClient { + return &LbConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *LbConfigClient) Create(container *LbConfig) (*LbConfig, error) { + resp := &LbConfig{} + err := c.rancherClient.doCreate(LB_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *LbConfigClient) Update(existing *LbConfig, updates interface{}) (*LbConfig, error) { + resp := &LbConfig{} + err := c.rancherClient.doUpdate(LB_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LbConfigClient) List(opts *ListOpts) (*LbConfigCollection, error) { + resp := &LbConfigCollection{} + err := c.rancherClient.doList(LB_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LbConfigCollection) Next() (*LbConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LbConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LbConfigClient) ById(id string) (*LbConfig, error) { + resp := &LbConfig{} + err := c.rancherClient.doById(LB_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LbConfigClient) Delete(container *LbConfig) error { + return c.rancherClient.doResourceDelete(LB_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_lb_target_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_lb_target_config.go new file mode 100644 index 0000000000..93088a6f47 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_lb_target_config.go @@ -0,0 +1,79 @@ +package client + +const ( + LB_TARGET_CONFIG_TYPE = "lbTargetConfig" +) + +type LbTargetConfig struct { + Resource + + PortRules []TargetPortRule `json:"portRules,omitempty" yaml:"port_rules,omitempty"` +} + +type LbTargetConfigCollection struct { + Collection + Data []LbTargetConfig `json:"data,omitempty"` + client *LbTargetConfigClient +} + +type LbTargetConfigClient struct { + rancherClient *RancherClient +} + +type LbTargetConfigOperations interface { + List(opts *ListOpts) (*LbTargetConfigCollection, error) + Create(opts *LbTargetConfig) (*LbTargetConfig, error) + Update(existing *LbTargetConfig, updates interface{}) (*LbTargetConfig, error) + ById(id string) (*LbTargetConfig, error) + Delete(container *LbTargetConfig) error +} + +func newLbTargetConfigClient(rancherClient *RancherClient) *LbTargetConfigClient { + return &LbTargetConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *LbTargetConfigClient) Create(container *LbTargetConfig) (*LbTargetConfig, error) { + resp := &LbTargetConfig{} + err := c.rancherClient.doCreate(LB_TARGET_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *LbTargetConfigClient) Update(existing *LbTargetConfig, updates interface{}) (*LbTargetConfig, error) { + resp := &LbTargetConfig{} + err := c.rancherClient.doUpdate(LB_TARGET_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LbTargetConfigClient) List(opts *ListOpts) (*LbTargetConfigCollection, error) { + resp := &LbTargetConfigCollection{} + err := c.rancherClient.doList(LB_TARGET_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LbTargetConfigCollection) Next() (*LbTargetConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LbTargetConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LbTargetConfigClient) ById(id string) (*LbTargetConfig, error) { + resp := &LbTargetConfig{} + err := c.rancherClient.doById(LB_TARGET_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LbTargetConfigClient) Delete(container *LbTargetConfig) error { + return c.rancherClient.doResourceDelete(LB_TARGET_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_cookie_stickiness_policy.go b/vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_cookie_stickiness_policy.go new file mode 100644 index 0000000000..4a8d698933 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_cookie_stickiness_policy.go @@ -0,0 +1,91 @@ +package client + +const ( + LOAD_BALANCER_COOKIE_STICKINESS_POLICY_TYPE = "loadBalancerCookieStickinessPolicy" +) + +type LoadBalancerCookieStickinessPolicy struct { + Resource + + Cookie string `json:"cookie,omitempty" yaml:"cookie,omitempty"` + + Domain string `json:"domain,omitempty" yaml:"domain,omitempty"` + + Indirect bool `json:"indirect,omitempty" yaml:"indirect,omitempty"` + + Mode string `json:"mode,omitempty" yaml:"mode,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Nocache bool `json:"nocache,omitempty" yaml:"nocache,omitempty"` + + Postonly bool `json:"postonly,omitempty" yaml:"postonly,omitempty"` +} + +type LoadBalancerCookieStickinessPolicyCollection struct { + Collection + Data []LoadBalancerCookieStickinessPolicy `json:"data,omitempty"` + client *LoadBalancerCookieStickinessPolicyClient +} + +type LoadBalancerCookieStickinessPolicyClient struct { + rancherClient *RancherClient +} + +type LoadBalancerCookieStickinessPolicyOperations interface { + List(opts *ListOpts) (*LoadBalancerCookieStickinessPolicyCollection, error) + Create(opts *LoadBalancerCookieStickinessPolicy) (*LoadBalancerCookieStickinessPolicy, error) + Update(existing *LoadBalancerCookieStickinessPolicy, updates interface{}) (*LoadBalancerCookieStickinessPolicy, error) + ById(id string) (*LoadBalancerCookieStickinessPolicy, error) + Delete(container *LoadBalancerCookieStickinessPolicy) error +} + +func newLoadBalancerCookieStickinessPolicyClient(rancherClient *RancherClient) *LoadBalancerCookieStickinessPolicyClient { + return &LoadBalancerCookieStickinessPolicyClient{ + rancherClient: rancherClient, + } +} + +func (c *LoadBalancerCookieStickinessPolicyClient) Create(container *LoadBalancerCookieStickinessPolicy) (*LoadBalancerCookieStickinessPolicy, error) { + resp := &LoadBalancerCookieStickinessPolicy{} + err := c.rancherClient.doCreate(LOAD_BALANCER_COOKIE_STICKINESS_POLICY_TYPE, container, resp) + return resp, err +} + +func (c *LoadBalancerCookieStickinessPolicyClient) Update(existing *LoadBalancerCookieStickinessPolicy, updates interface{}) (*LoadBalancerCookieStickinessPolicy, error) { + resp := &LoadBalancerCookieStickinessPolicy{} + err := c.rancherClient.doUpdate(LOAD_BALANCER_COOKIE_STICKINESS_POLICY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LoadBalancerCookieStickinessPolicyClient) List(opts *ListOpts) (*LoadBalancerCookieStickinessPolicyCollection, error) { + resp := &LoadBalancerCookieStickinessPolicyCollection{} + err := c.rancherClient.doList(LOAD_BALANCER_COOKIE_STICKINESS_POLICY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LoadBalancerCookieStickinessPolicyCollection) Next() (*LoadBalancerCookieStickinessPolicyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LoadBalancerCookieStickinessPolicyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LoadBalancerCookieStickinessPolicyClient) ById(id string) (*LoadBalancerCookieStickinessPolicy, error) { + resp := &LoadBalancerCookieStickinessPolicy{} + err := c.rancherClient.doById(LOAD_BALANCER_COOKIE_STICKINESS_POLICY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LoadBalancerCookieStickinessPolicyClient) Delete(container *LoadBalancerCookieStickinessPolicy) error { + return c.rancherClient.doResourceDelete(LOAD_BALANCER_COOKIE_STICKINESS_POLICY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_service.go new file mode 100644 index 0000000000..941ccb087b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_load_balancer_service.go @@ -0,0 +1,297 @@ +package client + +const ( + LOAD_BALANCER_SERVICE_TYPE = "loadBalancerService" +) + +type LoadBalancerService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AssignServiceIpAddress bool `json:"assignServiceIpAddress,omitempty" yaml:"assign_service_ip_address,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LbConfig *LbConfig `json:"lbConfig,omitempty" yaml:"lb_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RetainIp bool `json:"retainIp,omitempty" yaml:"retain_ip,omitempty"` + + Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Upgrade *ServiceUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vip string `json:"vip,omitempty" yaml:"vip,omitempty"` +} + +type LoadBalancerServiceCollection struct { + Collection + Data []LoadBalancerService `json:"data,omitempty"` + client *LoadBalancerServiceClient +} + +type LoadBalancerServiceClient struct { + rancherClient *RancherClient +} + +type LoadBalancerServiceOperations interface { + List(opts *ListOpts) (*LoadBalancerServiceCollection, error) + Create(opts *LoadBalancerService) (*LoadBalancerService, error) + Update(existing *LoadBalancerService, updates interface{}) (*LoadBalancerService, error) + ById(id string) (*LoadBalancerService, error) + Delete(container *LoadBalancerService) error + + ActionActivate(*LoadBalancerService) (*Service, error) + + ActionAddservicelink(*LoadBalancerService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionCancelupgrade(*LoadBalancerService) (*Service, error) + + ActionContinueupgrade(*LoadBalancerService) (*Service, error) + + ActionCreate(*LoadBalancerService) (*Service, error) + + ActionDeactivate(*LoadBalancerService) (*Service, error) + + ActionFinishupgrade(*LoadBalancerService) (*Service, error) + + ActionRemove(*LoadBalancerService) (*Service, error) + + ActionRemoveservicelink(*LoadBalancerService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionRestart(*LoadBalancerService, *ServiceRestart) (*Service, error) + + ActionRollback(*LoadBalancerService) (*Service, error) + + ActionSetservicelinks(*LoadBalancerService, *SetServiceLinksInput) (*Service, error) + + ActionUpdate(*LoadBalancerService) (*Service, error) + + ActionUpgrade(*LoadBalancerService, *ServiceUpgrade) (*Service, error) +} + +func newLoadBalancerServiceClient(rancherClient *RancherClient) *LoadBalancerServiceClient { + return &LoadBalancerServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *LoadBalancerServiceClient) Create(container *LoadBalancerService) (*LoadBalancerService, error) { + resp := &LoadBalancerService{} + err := c.rancherClient.doCreate(LOAD_BALANCER_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *LoadBalancerServiceClient) Update(existing *LoadBalancerService, updates interface{}) (*LoadBalancerService, error) { + resp := &LoadBalancerService{} + err := c.rancherClient.doUpdate(LOAD_BALANCER_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LoadBalancerServiceClient) List(opts *ListOpts) (*LoadBalancerServiceCollection, error) { + resp := &LoadBalancerServiceCollection{} + err := c.rancherClient.doList(LOAD_BALANCER_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LoadBalancerServiceCollection) Next() (*LoadBalancerServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LoadBalancerServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LoadBalancerServiceClient) ById(id string) (*LoadBalancerService, error) { + resp := &LoadBalancerService{} + err := c.rancherClient.doById(LOAD_BALANCER_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LoadBalancerServiceClient) Delete(container *LoadBalancerService) error { + return c.rancherClient.doResourceDelete(LOAD_BALANCER_SERVICE_TYPE, &container.Resource) +} + +func (c *LoadBalancerServiceClient) ActionActivate(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionAddservicelink(resource *LoadBalancerService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionCancelupgrade(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionContinueupgrade(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionCreate(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionDeactivate(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionFinishupgrade(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionRemove(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionRemoveservicelink(resource *LoadBalancerService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionRestart(resource *LoadBalancerService, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionRollback(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionSetservicelinks(resource *LoadBalancerService, input *SetServiceLinksInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionUpdate(resource *LoadBalancerService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *LoadBalancerServiceClient) ActionUpgrade(resource *LoadBalancerService, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(LOAD_BALANCER_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_local_auth_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_local_auth_config.go new file mode 100644 index 0000000000..664f137c10 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_local_auth_config.go @@ -0,0 +1,87 @@ +package client + +const ( + LOCAL_AUTH_CONFIG_TYPE = "localAuthConfig" +) + +type LocalAuthConfig struct { + Resource + + AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"` + + Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Password string `json:"password,omitempty" yaml:"password,omitempty"` + + Username string `json:"username,omitempty" yaml:"username,omitempty"` +} + +type LocalAuthConfigCollection struct { + Collection + Data []LocalAuthConfig `json:"data,omitempty"` + client *LocalAuthConfigClient +} + +type LocalAuthConfigClient struct { + rancherClient *RancherClient +} + +type LocalAuthConfigOperations interface { + List(opts *ListOpts) (*LocalAuthConfigCollection, error) + Create(opts *LocalAuthConfig) (*LocalAuthConfig, error) + Update(existing *LocalAuthConfig, updates interface{}) (*LocalAuthConfig, error) + ById(id string) (*LocalAuthConfig, error) + Delete(container *LocalAuthConfig) error +} + +func newLocalAuthConfigClient(rancherClient *RancherClient) *LocalAuthConfigClient { + return &LocalAuthConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *LocalAuthConfigClient) Create(container *LocalAuthConfig) (*LocalAuthConfig, error) { + resp := &LocalAuthConfig{} + err := c.rancherClient.doCreate(LOCAL_AUTH_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *LocalAuthConfigClient) Update(existing *LocalAuthConfig, updates interface{}) (*LocalAuthConfig, error) { + resp := &LocalAuthConfig{} + err := c.rancherClient.doUpdate(LOCAL_AUTH_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LocalAuthConfigClient) List(opts *ListOpts) (*LocalAuthConfigCollection, error) { + resp := &LocalAuthConfigCollection{} + err := c.rancherClient.doList(LOCAL_AUTH_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LocalAuthConfigCollection) Next() (*LocalAuthConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LocalAuthConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LocalAuthConfigClient) ById(id string) (*LocalAuthConfig, error) { + resp := &LocalAuthConfig{} + err := c.rancherClient.doById(LOCAL_AUTH_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LocalAuthConfigClient) Delete(container *LocalAuthConfig) error { + return c.rancherClient.doResourceDelete(LOCAL_AUTH_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_log_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_log_config.go new file mode 100644 index 0000000000..3f799aac92 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_log_config.go @@ -0,0 +1,81 @@ +package client + +const ( + LOG_CONFIG_TYPE = "logConfig" +) + +type LogConfig struct { + Resource + + Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` +} + +type LogConfigCollection struct { + Collection + Data []LogConfig `json:"data,omitempty"` + client *LogConfigClient +} + +type LogConfigClient struct { + rancherClient *RancherClient +} + +type LogConfigOperations interface { + List(opts *ListOpts) (*LogConfigCollection, error) + Create(opts *LogConfig) (*LogConfig, error) + Update(existing *LogConfig, updates interface{}) (*LogConfig, error) + ById(id string) (*LogConfig, error) + Delete(container *LogConfig) error +} + +func newLogConfigClient(rancherClient *RancherClient) *LogConfigClient { + return &LogConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *LogConfigClient) Create(container *LogConfig) (*LogConfig, error) { + resp := &LogConfig{} + err := c.rancherClient.doCreate(LOG_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *LogConfigClient) Update(existing *LogConfig, updates interface{}) (*LogConfig, error) { + resp := &LogConfig{} + err := c.rancherClient.doUpdate(LOG_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LogConfigClient) List(opts *ListOpts) (*LogConfigCollection, error) { + resp := &LogConfigCollection{} + err := c.rancherClient.doList(LOG_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LogConfigCollection) Next() (*LogConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LogConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LogConfigClient) ById(id string) (*LogConfig, error) { + resp := &LogConfig{} + err := c.rancherClient.doById(LOG_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *LogConfigClient) Delete(container *LogConfig) error { + return c.rancherClient.doResourceDelete(LOG_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_machine.go b/vendor/github.com/rancher/go-rancher/v2/generated_machine.go new file mode 100644 index 0000000000..5931b982ee --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_machine.go @@ -0,0 +1,194 @@ +package client + +const ( + MACHINE_TYPE = "machine" +) + +type Machine struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Amazonec2Config *Amazonec2Config `json:"amazonec2Config,omitempty" yaml:"amazonec2config,omitempty"` + + AuthCertificateAuthority string `json:"authCertificateAuthority,omitempty" yaml:"auth_certificate_authority,omitempty"` + + AuthKey string `json:"authKey,omitempty" yaml:"auth_key,omitempty"` + + AzureConfig *AzureConfig `json:"azureConfig,omitempty" yaml:"azure_config,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DigitaloceanConfig *DigitaloceanConfig `json:"digitaloceanConfig,omitempty" yaml:"digitalocean_config,omitempty"` + + DockerVersion string `json:"dockerVersion,omitempty" yaml:"docker_version,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + EngineEnv map[string]interface{} `json:"engineEnv,omitempty" yaml:"engine_env,omitempty"` + + EngineInsecureRegistry []string `json:"engineInsecureRegistry,omitempty" yaml:"engine_insecure_registry,omitempty"` + + EngineInstallUrl string `json:"engineInstallUrl,omitempty" yaml:"engine_install_url,omitempty"` + + EngineLabel map[string]interface{} `json:"engineLabel,omitempty" yaml:"engine_label,omitempty"` + + EngineOpt map[string]interface{} `json:"engineOpt,omitempty" yaml:"engine_opt,omitempty"` + + EngineRegistryMirror []string `json:"engineRegistryMirror,omitempty" yaml:"engine_registry_mirror,omitempty"` + + EngineStorageDriver string `json:"engineStorageDriver,omitempty" yaml:"engine_storage_driver,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HostTemplateId string `json:"hostTemplateId,omitempty" yaml:"host_template_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PacketConfig *PacketConfig `json:"packetConfig,omitempty" yaml:"packet_config,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type MachineCollection struct { + Collection + Data []Machine `json:"data,omitempty"` + client *MachineClient +} + +type MachineClient struct { + rancherClient *RancherClient +} + +type MachineOperations interface { + List(opts *ListOpts) (*MachineCollection, error) + Create(opts *Machine) (*Machine, error) + Update(existing *Machine, updates interface{}) (*Machine, error) + ById(id string) (*Machine, error) + Delete(container *Machine) error + + ActionBootstrap(*Machine) (*PhysicalHost, error) + + ActionCreate(*Machine) (*PhysicalHost, error) + + ActionError(*Machine) (*PhysicalHost, error) + + ActionRemove(*Machine) (*PhysicalHost, error) + + ActionUpdate(*Machine) (*PhysicalHost, error) +} + +func newMachineClient(rancherClient *RancherClient) *MachineClient { + return &MachineClient{ + rancherClient: rancherClient, + } +} + +func (c *MachineClient) Create(container *Machine) (*Machine, error) { + resp := &Machine{} + err := c.rancherClient.doCreate(MACHINE_TYPE, container, resp) + return resp, err +} + +func (c *MachineClient) Update(existing *Machine, updates interface{}) (*Machine, error) { + resp := &Machine{} + err := c.rancherClient.doUpdate(MACHINE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *MachineClient) List(opts *ListOpts) (*MachineCollection, error) { + resp := &MachineCollection{} + err := c.rancherClient.doList(MACHINE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *MachineCollection) Next() (*MachineCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &MachineCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *MachineClient) ById(id string) (*Machine, error) { + resp := &Machine{} + err := c.rancherClient.doById(MACHINE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *MachineClient) Delete(container *Machine) error { + return c.rancherClient.doResourceDelete(MACHINE_TYPE, &container.Resource) +} + +func (c *MachineClient) ActionBootstrap(resource *Machine) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(MACHINE_TYPE, "bootstrap", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineClient) ActionCreate(resource *Machine) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(MACHINE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineClient) ActionError(resource *Machine) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(MACHINE_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineClient) ActionRemove(resource *Machine) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(MACHINE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineClient) ActionUpdate(resource *Machine) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(MACHINE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_machine_driver.go b/vendor/github.com/rancher/go-rancher/v2/generated_machine_driver.go new file mode 100644 index 0000000000..a0b70653cd --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_machine_driver.go @@ -0,0 +1,192 @@ +package client + +const ( + MACHINE_DRIVER_TYPE = "machineDriver" +) + +type MachineDriver struct { + Resource + + ActivateOnCreate bool `json:"activateOnCreate,omitempty" yaml:"activate_on_create,omitempty"` + + Builtin bool `json:"builtin,omitempty" yaml:"builtin,omitempty"` + + Checksum string `json:"checksum,omitempty" yaml:"checksum,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DefaultActive bool `json:"defaultActive,omitempty" yaml:"default_active,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + UiUrl string `json:"uiUrl,omitempty" yaml:"ui_url,omitempty"` + + Url string `json:"url,omitempty" yaml:"url,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type MachineDriverCollection struct { + Collection + Data []MachineDriver `json:"data,omitempty"` + client *MachineDriverClient +} + +type MachineDriverClient struct { + rancherClient *RancherClient +} + +type MachineDriverOperations interface { + List(opts *ListOpts) (*MachineDriverCollection, error) + Create(opts *MachineDriver) (*MachineDriver, error) + Update(existing *MachineDriver, updates interface{}) (*MachineDriver, error) + ById(id string) (*MachineDriver, error) + Delete(container *MachineDriver) error + + ActionActivate(*MachineDriver) (*MachineDriver, error) + + ActionCreate(*MachineDriver) (*MachineDriver, error) + + ActionDeactivate(*MachineDriver) (*MachineDriver, error) + + ActionError(*MachineDriver) (*MachineDriver, error) + + ActionReactivate(*MachineDriver) (*MachineDriver, error) + + ActionRemove(*MachineDriver) (*MachineDriver, error) + + ActionUpdate(*MachineDriver) (*MachineDriver, error) +} + +func newMachineDriverClient(rancherClient *RancherClient) *MachineDriverClient { + return &MachineDriverClient{ + rancherClient: rancherClient, + } +} + +func (c *MachineDriverClient) Create(container *MachineDriver) (*MachineDriver, error) { + resp := &MachineDriver{} + err := c.rancherClient.doCreate(MACHINE_DRIVER_TYPE, container, resp) + return resp, err +} + +func (c *MachineDriverClient) Update(existing *MachineDriver, updates interface{}) (*MachineDriver, error) { + resp := &MachineDriver{} + err := c.rancherClient.doUpdate(MACHINE_DRIVER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *MachineDriverClient) List(opts *ListOpts) (*MachineDriverCollection, error) { + resp := &MachineDriverCollection{} + err := c.rancherClient.doList(MACHINE_DRIVER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *MachineDriverCollection) Next() (*MachineDriverCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &MachineDriverCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *MachineDriverClient) ById(id string) (*MachineDriver, error) { + resp := &MachineDriver{} + err := c.rancherClient.doById(MACHINE_DRIVER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *MachineDriverClient) Delete(container *MachineDriver) error { + return c.rancherClient.doResourceDelete(MACHINE_DRIVER_TYPE, &container.Resource) +} + +func (c *MachineDriverClient) ActionActivate(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineDriverClient) ActionCreate(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineDriverClient) ActionDeactivate(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineDriverClient) ActionError(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineDriverClient) ActionReactivate(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "reactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineDriverClient) ActionRemove(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MachineDriverClient) ActionUpdate(resource *MachineDriver) (*MachineDriver, error) { + + resp := &MachineDriver{} + + err := c.rancherClient.doAction(MACHINE_DRIVER_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_mount.go b/vendor/github.com/rancher/go-rancher/v2/generated_mount.go new file mode 100644 index 0000000000..efa68a501e --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_mount.go @@ -0,0 +1,144 @@ +package client + +const ( + MOUNT_TYPE = "mount" +) + +type Mount struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Path string `json:"path,omitempty" yaml:"path,omitempty"` + + Permissions string `json:"permissions,omitempty" yaml:"permissions,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeId string `json:"volumeId,omitempty" yaml:"volume_id,omitempty"` +} + +type MountCollection struct { + Collection + Data []Mount `json:"data,omitempty"` + client *MountClient +} + +type MountClient struct { + rancherClient *RancherClient +} + +type MountOperations interface { + List(opts *ListOpts) (*MountCollection, error) + Create(opts *Mount) (*Mount, error) + Update(existing *Mount, updates interface{}) (*Mount, error) + ById(id string) (*Mount, error) + Delete(container *Mount) error + + ActionCreate(*Mount) (*Mount, error) + + ActionDeactivate(*Mount) (*Mount, error) + + ActionRemove(*Mount) (*Mount, error) +} + +func newMountClient(rancherClient *RancherClient) *MountClient { + return &MountClient{ + rancherClient: rancherClient, + } +} + +func (c *MountClient) Create(container *Mount) (*Mount, error) { + resp := &Mount{} + err := c.rancherClient.doCreate(MOUNT_TYPE, container, resp) + return resp, err +} + +func (c *MountClient) Update(existing *Mount, updates interface{}) (*Mount, error) { + resp := &Mount{} + err := c.rancherClient.doUpdate(MOUNT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *MountClient) List(opts *ListOpts) (*MountCollection, error) { + resp := &MountCollection{} + err := c.rancherClient.doList(MOUNT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *MountCollection) Next() (*MountCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &MountCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *MountClient) ById(id string) (*Mount, error) { + resp := &Mount{} + err := c.rancherClient.doById(MOUNT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *MountClient) Delete(container *Mount) error { + return c.rancherClient.doResourceDelete(MOUNT_TYPE, &container.Resource) +} + +func (c *MountClient) ActionCreate(resource *Mount) (*Mount, error) { + + resp := &Mount{} + + err := c.rancherClient.doAction(MOUNT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MountClient) ActionDeactivate(resource *Mount) (*Mount, error) { + + resp := &Mount{} + + err := c.rancherClient.doAction(MOUNT_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *MountClient) ActionRemove(resource *Mount) (*Mount, error) { + + resp := &Mount{} + + err := c.rancherClient.doAction(MOUNT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_mount_entry.go b/vendor/github.com/rancher/go-rancher/v2/generated_mount_entry.go new file mode 100644 index 0000000000..62d4f4fa19 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_mount_entry.go @@ -0,0 +1,87 @@ +package client + +const ( + MOUNT_ENTRY_TYPE = "mountEntry" +) + +type MountEntry struct { + Resource + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + InstanceName string `json:"instanceName,omitempty" yaml:"instance_name,omitempty"` + + Path string `json:"path,omitempty" yaml:"path,omitempty"` + + VolumeId string `json:"volumeId,omitempty" yaml:"volume_id,omitempty"` + + VolumeName string `json:"volumeName,omitempty" yaml:"volume_name,omitempty"` +} + +type MountEntryCollection struct { + Collection + Data []MountEntry `json:"data,omitempty"` + client *MountEntryClient +} + +type MountEntryClient struct { + rancherClient *RancherClient +} + +type MountEntryOperations interface { + List(opts *ListOpts) (*MountEntryCollection, error) + Create(opts *MountEntry) (*MountEntry, error) + Update(existing *MountEntry, updates interface{}) (*MountEntry, error) + ById(id string) (*MountEntry, error) + Delete(container *MountEntry) error +} + +func newMountEntryClient(rancherClient *RancherClient) *MountEntryClient { + return &MountEntryClient{ + rancherClient: rancherClient, + } +} + +func (c *MountEntryClient) Create(container *MountEntry) (*MountEntry, error) { + resp := &MountEntry{} + err := c.rancherClient.doCreate(MOUNT_ENTRY_TYPE, container, resp) + return resp, err +} + +func (c *MountEntryClient) Update(existing *MountEntry, updates interface{}) (*MountEntry, error) { + resp := &MountEntry{} + err := c.rancherClient.doUpdate(MOUNT_ENTRY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *MountEntryClient) List(opts *ListOpts) (*MountEntryCollection, error) { + resp := &MountEntryCollection{} + err := c.rancherClient.doList(MOUNT_ENTRY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *MountEntryCollection) Next() (*MountEntryCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &MountEntryCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *MountEntryClient) ById(id string) (*MountEntry, error) { + resp := &MountEntry{} + err := c.rancherClient.doById(MOUNT_ENTRY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *MountEntryClient) Delete(container *MountEntry) error { + return c.rancherClient.doResourceDelete(MOUNT_ENTRY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network.go b/vendor/github.com/rancher/go-rancher/v2/generated_network.go new file mode 100644 index 0000000000..ce77246dcb --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network.go @@ -0,0 +1,185 @@ +package client + +const ( + NETWORK_TYPE = "network" +) + +type Network struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DefaultPolicyAction string `json:"defaultPolicyAction,omitempty" yaml:"default_policy_action,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"` + + HostPorts bool `json:"hostPorts,omitempty" yaml:"host_ports,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NetworkDriverId string `json:"networkDriverId,omitempty" yaml:"network_driver_id,omitempty"` + + Policy []NetworkPolicyRule `json:"policy,omitempty" yaml:"policy,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Subnets []Subnet `json:"subnets,omitempty" yaml:"subnets,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type NetworkCollection struct { + Collection + Data []Network `json:"data,omitempty"` + client *NetworkClient +} + +type NetworkClient struct { + rancherClient *RancherClient +} + +type NetworkOperations interface { + List(opts *ListOpts) (*NetworkCollection, error) + Create(opts *Network) (*Network, error) + Update(existing *Network, updates interface{}) (*Network, error) + ById(id string) (*Network, error) + Delete(container *Network) error + + ActionActivate(*Network) (*Network, error) + + ActionCreate(*Network) (*Network, error) + + ActionDeactivate(*Network) (*Network, error) + + ActionPurge(*Network) (*Network, error) + + ActionRemove(*Network) (*Network, error) + + ActionUpdate(*Network) (*Network, error) +} + +func newNetworkClient(rancherClient *RancherClient) *NetworkClient { + return &NetworkClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkClient) Create(container *Network) (*Network, error) { + resp := &Network{} + err := c.rancherClient.doCreate(NETWORK_TYPE, container, resp) + return resp, err +} + +func (c *NetworkClient) Update(existing *Network, updates interface{}) (*Network, error) { + resp := &Network{} + err := c.rancherClient.doUpdate(NETWORK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkClient) List(opts *ListOpts) (*NetworkCollection, error) { + resp := &NetworkCollection{} + err := c.rancherClient.doList(NETWORK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkCollection) Next() (*NetworkCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkClient) ById(id string) (*Network, error) { + resp := &Network{} + err := c.rancherClient.doById(NETWORK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkClient) Delete(container *Network) error { + return c.rancherClient.doResourceDelete(NETWORK_TYPE, &container.Resource) +} + +func (c *NetworkClient) ActionActivate(resource *Network) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(NETWORK_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkClient) ActionCreate(resource *Network) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(NETWORK_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkClient) ActionDeactivate(resource *Network) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(NETWORK_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkClient) ActionPurge(resource *Network) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(NETWORK_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkClient) ActionRemove(resource *Network) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(NETWORK_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkClient) ActionUpdate(resource *Network) (*Network, error) { + + resp := &Network{} + + err := c.rancherClient.doAction(NETWORK_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network_driver.go b/vendor/github.com/rancher/go-rancher/v2/generated_network_driver.go new file mode 100644 index 0000000000..ea35cfebb9 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network_driver.go @@ -0,0 +1,166 @@ +package client + +const ( + NETWORK_DRIVER_TYPE = "networkDriver" +) + +type NetworkDriver struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + CniConfig map[string]interface{} `json:"cniConfig,omitempty" yaml:"cni_config,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DefaultNetwork DefaultNetwork `json:"defaultNetwork,omitempty" yaml:"default_network,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NetworkMetadata map[string]interface{} `json:"networkMetadata,omitempty" yaml:"network_metadata,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type NetworkDriverCollection struct { + Collection + Data []NetworkDriver `json:"data,omitempty"` + client *NetworkDriverClient +} + +type NetworkDriverClient struct { + rancherClient *RancherClient +} + +type NetworkDriverOperations interface { + List(opts *ListOpts) (*NetworkDriverCollection, error) + Create(opts *NetworkDriver) (*NetworkDriver, error) + Update(existing *NetworkDriver, updates interface{}) (*NetworkDriver, error) + ById(id string) (*NetworkDriver, error) + Delete(container *NetworkDriver) error + + ActionActivate(*NetworkDriver) (*NetworkDriver, error) + + ActionCreate(*NetworkDriver) (*NetworkDriver, error) + + ActionDeactivate(*NetworkDriver) (*NetworkDriver, error) + + ActionRemove(*NetworkDriver) (*NetworkDriver, error) + + ActionUpdate(*NetworkDriver) (*NetworkDriver, error) +} + +func newNetworkDriverClient(rancherClient *RancherClient) *NetworkDriverClient { + return &NetworkDriverClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkDriverClient) Create(container *NetworkDriver) (*NetworkDriver, error) { + resp := &NetworkDriver{} + err := c.rancherClient.doCreate(NETWORK_DRIVER_TYPE, container, resp) + return resp, err +} + +func (c *NetworkDriverClient) Update(existing *NetworkDriver, updates interface{}) (*NetworkDriver, error) { + resp := &NetworkDriver{} + err := c.rancherClient.doUpdate(NETWORK_DRIVER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkDriverClient) List(opts *ListOpts) (*NetworkDriverCollection, error) { + resp := &NetworkDriverCollection{} + err := c.rancherClient.doList(NETWORK_DRIVER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkDriverCollection) Next() (*NetworkDriverCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkDriverCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkDriverClient) ById(id string) (*NetworkDriver, error) { + resp := &NetworkDriver{} + err := c.rancherClient.doById(NETWORK_DRIVER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkDriverClient) Delete(container *NetworkDriver) error { + return c.rancherClient.doResourceDelete(NETWORK_DRIVER_TYPE, &container.Resource) +} + +func (c *NetworkDriverClient) ActionActivate(resource *NetworkDriver) (*NetworkDriver, error) { + + resp := &NetworkDriver{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverClient) ActionCreate(resource *NetworkDriver) (*NetworkDriver, error) { + + resp := &NetworkDriver{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverClient) ActionDeactivate(resource *NetworkDriver) (*NetworkDriver, error) { + + resp := &NetworkDriver{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverClient) ActionRemove(resource *NetworkDriver) (*NetworkDriver, error) { + + resp := &NetworkDriver{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverClient) ActionUpdate(resource *NetworkDriver) (*NetworkDriver, error) { + + resp := &NetworkDriver{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network_driver_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_network_driver_service.go new file mode 100644 index 0000000000..9317af3f4d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network_driver_service.go @@ -0,0 +1,305 @@ +package client + +const ( + NETWORK_DRIVER_SERVICE_TYPE = "networkDriverService" +) + +type NetworkDriverService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AssignServiceIpAddress bool `json:"assignServiceIpAddress,omitempty" yaml:"assign_service_ip_address,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LbConfig *LbTargetConfig `json:"lbConfig,omitempty" yaml:"lb_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NetworkDriver NetworkDriver `json:"networkDriver,omitempty" yaml:"network_driver,omitempty"` + + PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RetainIp bool `json:"retainIp,omitempty" yaml:"retain_ip,omitempty"` + + Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + + SecondaryLaunchConfigs []SecondaryLaunchConfig `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"` + + SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` + + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Upgrade *ServiceUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vip string `json:"vip,omitempty" yaml:"vip,omitempty"` +} + +type NetworkDriverServiceCollection struct { + Collection + Data []NetworkDriverService `json:"data,omitempty"` + client *NetworkDriverServiceClient +} + +type NetworkDriverServiceClient struct { + rancherClient *RancherClient +} + +type NetworkDriverServiceOperations interface { + List(opts *ListOpts) (*NetworkDriverServiceCollection, error) + Create(opts *NetworkDriverService) (*NetworkDriverService, error) + Update(existing *NetworkDriverService, updates interface{}) (*NetworkDriverService, error) + ById(id string) (*NetworkDriverService, error) + Delete(container *NetworkDriverService) error + + ActionActivate(*NetworkDriverService) (*Service, error) + + ActionAddservicelink(*NetworkDriverService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionCancelupgrade(*NetworkDriverService) (*Service, error) + + ActionContinueupgrade(*NetworkDriverService) (*Service, error) + + ActionCreate(*NetworkDriverService) (*Service, error) + + ActionDeactivate(*NetworkDriverService) (*Service, error) + + ActionFinishupgrade(*NetworkDriverService) (*Service, error) + + ActionRemove(*NetworkDriverService) (*Service, error) + + ActionRemoveservicelink(*NetworkDriverService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionRestart(*NetworkDriverService, *ServiceRestart) (*Service, error) + + ActionRollback(*NetworkDriverService) (*Service, error) + + ActionSetservicelinks(*NetworkDriverService, *SetServiceLinksInput) (*Service, error) + + ActionUpdate(*NetworkDriverService) (*Service, error) + + ActionUpgrade(*NetworkDriverService, *ServiceUpgrade) (*Service, error) +} + +func newNetworkDriverServiceClient(rancherClient *RancherClient) *NetworkDriverServiceClient { + return &NetworkDriverServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkDriverServiceClient) Create(container *NetworkDriverService) (*NetworkDriverService, error) { + resp := &NetworkDriverService{} + err := c.rancherClient.doCreate(NETWORK_DRIVER_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *NetworkDriverServiceClient) Update(existing *NetworkDriverService, updates interface{}) (*NetworkDriverService, error) { + resp := &NetworkDriverService{} + err := c.rancherClient.doUpdate(NETWORK_DRIVER_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkDriverServiceClient) List(opts *ListOpts) (*NetworkDriverServiceCollection, error) { + resp := &NetworkDriverServiceCollection{} + err := c.rancherClient.doList(NETWORK_DRIVER_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkDriverServiceCollection) Next() (*NetworkDriverServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkDriverServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkDriverServiceClient) ById(id string) (*NetworkDriverService, error) { + resp := &NetworkDriverService{} + err := c.rancherClient.doById(NETWORK_DRIVER_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkDriverServiceClient) Delete(container *NetworkDriverService) error { + return c.rancherClient.doResourceDelete(NETWORK_DRIVER_SERVICE_TYPE, &container.Resource) +} + +func (c *NetworkDriverServiceClient) ActionActivate(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionAddservicelink(resource *NetworkDriverService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionCancelupgrade(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionContinueupgrade(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionCreate(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionDeactivate(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionFinishupgrade(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionRemove(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionRemoveservicelink(resource *NetworkDriverService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionRestart(resource *NetworkDriverService, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionRollback(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionSetservicelinks(resource *NetworkDriverService, input *SetServiceLinksInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionUpdate(resource *NetworkDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *NetworkDriverServiceClient) ActionUpgrade(resource *NetworkDriverService, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(NETWORK_DRIVER_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule.go b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule.go new file mode 100644 index 0000000000..6f62f28155 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule.go @@ -0,0 +1,89 @@ +package client + +const ( + NETWORK_POLICY_RULE_TYPE = "networkPolicyRule" +) + +type NetworkPolicyRule struct { + Resource + + Action string `json:"action,omitempty" yaml:"action,omitempty"` + + Between NetworkPolicyRuleBetween `json:"between,omitempty" yaml:"between,omitempty"` + + From NetworkPolicyRuleMember `json:"from,omitempty" yaml:"from,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + + To NetworkPolicyRuleMember `json:"to,omitempty" yaml:"to,omitempty"` + + Within string `json:"within,omitempty" yaml:"within,omitempty"` +} + +type NetworkPolicyRuleCollection struct { + Collection + Data []NetworkPolicyRule `json:"data,omitempty"` + client *NetworkPolicyRuleClient +} + +type NetworkPolicyRuleClient struct { + rancherClient *RancherClient +} + +type NetworkPolicyRuleOperations interface { + List(opts *ListOpts) (*NetworkPolicyRuleCollection, error) + Create(opts *NetworkPolicyRule) (*NetworkPolicyRule, error) + Update(existing *NetworkPolicyRule, updates interface{}) (*NetworkPolicyRule, error) + ById(id string) (*NetworkPolicyRule, error) + Delete(container *NetworkPolicyRule) error +} + +func newNetworkPolicyRuleClient(rancherClient *RancherClient) *NetworkPolicyRuleClient { + return &NetworkPolicyRuleClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkPolicyRuleClient) Create(container *NetworkPolicyRule) (*NetworkPolicyRule, error) { + resp := &NetworkPolicyRule{} + err := c.rancherClient.doCreate(NETWORK_POLICY_RULE_TYPE, container, resp) + return resp, err +} + +func (c *NetworkPolicyRuleClient) Update(existing *NetworkPolicyRule, updates interface{}) (*NetworkPolicyRule, error) { + resp := &NetworkPolicyRule{} + err := c.rancherClient.doUpdate(NETWORK_POLICY_RULE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkPolicyRuleClient) List(opts *ListOpts) (*NetworkPolicyRuleCollection, error) { + resp := &NetworkPolicyRuleCollection{} + err := c.rancherClient.doList(NETWORK_POLICY_RULE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkPolicyRuleCollection) Next() (*NetworkPolicyRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkPolicyRuleCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkPolicyRuleClient) ById(id string) (*NetworkPolicyRule, error) { + resp := &NetworkPolicyRule{} + err := c.rancherClient.doById(NETWORK_POLICY_RULE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkPolicyRuleClient) Delete(container *NetworkPolicyRule) error { + return c.rancherClient.doResourceDelete(NETWORK_POLICY_RULE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_between.go b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_between.go new file mode 100644 index 0000000000..77e17662b3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_between.go @@ -0,0 +1,81 @@ +package client + +const ( + NETWORK_POLICY_RULE_BETWEEN_TYPE = "networkPolicyRuleBetween" +) + +type NetworkPolicyRuleBetween struct { + Resource + + GroupBy string `json:"groupBy,omitempty" yaml:"group_by,omitempty"` + + Selector string `json:"selector,omitempty" yaml:"selector,omitempty"` +} + +type NetworkPolicyRuleBetweenCollection struct { + Collection + Data []NetworkPolicyRuleBetween `json:"data,omitempty"` + client *NetworkPolicyRuleBetweenClient +} + +type NetworkPolicyRuleBetweenClient struct { + rancherClient *RancherClient +} + +type NetworkPolicyRuleBetweenOperations interface { + List(opts *ListOpts) (*NetworkPolicyRuleBetweenCollection, error) + Create(opts *NetworkPolicyRuleBetween) (*NetworkPolicyRuleBetween, error) + Update(existing *NetworkPolicyRuleBetween, updates interface{}) (*NetworkPolicyRuleBetween, error) + ById(id string) (*NetworkPolicyRuleBetween, error) + Delete(container *NetworkPolicyRuleBetween) error +} + +func newNetworkPolicyRuleBetweenClient(rancherClient *RancherClient) *NetworkPolicyRuleBetweenClient { + return &NetworkPolicyRuleBetweenClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkPolicyRuleBetweenClient) Create(container *NetworkPolicyRuleBetween) (*NetworkPolicyRuleBetween, error) { + resp := &NetworkPolicyRuleBetween{} + err := c.rancherClient.doCreate(NETWORK_POLICY_RULE_BETWEEN_TYPE, container, resp) + return resp, err +} + +func (c *NetworkPolicyRuleBetweenClient) Update(existing *NetworkPolicyRuleBetween, updates interface{}) (*NetworkPolicyRuleBetween, error) { + resp := &NetworkPolicyRuleBetween{} + err := c.rancherClient.doUpdate(NETWORK_POLICY_RULE_BETWEEN_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkPolicyRuleBetweenClient) List(opts *ListOpts) (*NetworkPolicyRuleBetweenCollection, error) { + resp := &NetworkPolicyRuleBetweenCollection{} + err := c.rancherClient.doList(NETWORK_POLICY_RULE_BETWEEN_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkPolicyRuleBetweenCollection) Next() (*NetworkPolicyRuleBetweenCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkPolicyRuleBetweenCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkPolicyRuleBetweenClient) ById(id string) (*NetworkPolicyRuleBetween, error) { + resp := &NetworkPolicyRuleBetween{} + err := c.rancherClient.doById(NETWORK_POLICY_RULE_BETWEEN_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkPolicyRuleBetweenClient) Delete(container *NetworkPolicyRuleBetween) error { + return c.rancherClient.doResourceDelete(NETWORK_POLICY_RULE_BETWEEN_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_member.go b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_member.go new file mode 100644 index 0000000000..e8e34e1083 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_member.go @@ -0,0 +1,79 @@ +package client + +const ( + NETWORK_POLICY_RULE_MEMBER_TYPE = "networkPolicyRuleMember" +) + +type NetworkPolicyRuleMember struct { + Resource + + Selector string `json:"selector,omitempty" yaml:"selector,omitempty"` +} + +type NetworkPolicyRuleMemberCollection struct { + Collection + Data []NetworkPolicyRuleMember `json:"data,omitempty"` + client *NetworkPolicyRuleMemberClient +} + +type NetworkPolicyRuleMemberClient struct { + rancherClient *RancherClient +} + +type NetworkPolicyRuleMemberOperations interface { + List(opts *ListOpts) (*NetworkPolicyRuleMemberCollection, error) + Create(opts *NetworkPolicyRuleMember) (*NetworkPolicyRuleMember, error) + Update(existing *NetworkPolicyRuleMember, updates interface{}) (*NetworkPolicyRuleMember, error) + ById(id string) (*NetworkPolicyRuleMember, error) + Delete(container *NetworkPolicyRuleMember) error +} + +func newNetworkPolicyRuleMemberClient(rancherClient *RancherClient) *NetworkPolicyRuleMemberClient { + return &NetworkPolicyRuleMemberClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkPolicyRuleMemberClient) Create(container *NetworkPolicyRuleMember) (*NetworkPolicyRuleMember, error) { + resp := &NetworkPolicyRuleMember{} + err := c.rancherClient.doCreate(NETWORK_POLICY_RULE_MEMBER_TYPE, container, resp) + return resp, err +} + +func (c *NetworkPolicyRuleMemberClient) Update(existing *NetworkPolicyRuleMember, updates interface{}) (*NetworkPolicyRuleMember, error) { + resp := &NetworkPolicyRuleMember{} + err := c.rancherClient.doUpdate(NETWORK_POLICY_RULE_MEMBER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkPolicyRuleMemberClient) List(opts *ListOpts) (*NetworkPolicyRuleMemberCollection, error) { + resp := &NetworkPolicyRuleMemberCollection{} + err := c.rancherClient.doList(NETWORK_POLICY_RULE_MEMBER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkPolicyRuleMemberCollection) Next() (*NetworkPolicyRuleMemberCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkPolicyRuleMemberCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkPolicyRuleMemberClient) ById(id string) (*NetworkPolicyRuleMember, error) { + resp := &NetworkPolicyRuleMember{} + err := c.rancherClient.doById(NETWORK_POLICY_RULE_MEMBER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkPolicyRuleMemberClient) Delete(container *NetworkPolicyRuleMember) error { + return c.rancherClient.doResourceDelete(NETWORK_POLICY_RULE_MEMBER_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_within.go b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_within.go new file mode 100644 index 0000000000..0472ee6784 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_network_policy_rule_within.go @@ -0,0 +1,77 @@ +package client + +const ( + NETWORK_POLICY_RULE_WITHIN_TYPE = "networkPolicyRuleWithin" +) + +type NetworkPolicyRuleWithin struct { + Resource +} + +type NetworkPolicyRuleWithinCollection struct { + Collection + Data []NetworkPolicyRuleWithin `json:"data,omitempty"` + client *NetworkPolicyRuleWithinClient +} + +type NetworkPolicyRuleWithinClient struct { + rancherClient *RancherClient +} + +type NetworkPolicyRuleWithinOperations interface { + List(opts *ListOpts) (*NetworkPolicyRuleWithinCollection, error) + Create(opts *NetworkPolicyRuleWithin) (*NetworkPolicyRuleWithin, error) + Update(existing *NetworkPolicyRuleWithin, updates interface{}) (*NetworkPolicyRuleWithin, error) + ById(id string) (*NetworkPolicyRuleWithin, error) + Delete(container *NetworkPolicyRuleWithin) error +} + +func newNetworkPolicyRuleWithinClient(rancherClient *RancherClient) *NetworkPolicyRuleWithinClient { + return &NetworkPolicyRuleWithinClient{ + rancherClient: rancherClient, + } +} + +func (c *NetworkPolicyRuleWithinClient) Create(container *NetworkPolicyRuleWithin) (*NetworkPolicyRuleWithin, error) { + resp := &NetworkPolicyRuleWithin{} + err := c.rancherClient.doCreate(NETWORK_POLICY_RULE_WITHIN_TYPE, container, resp) + return resp, err +} + +func (c *NetworkPolicyRuleWithinClient) Update(existing *NetworkPolicyRuleWithin, updates interface{}) (*NetworkPolicyRuleWithin, error) { + resp := &NetworkPolicyRuleWithin{} + err := c.rancherClient.doUpdate(NETWORK_POLICY_RULE_WITHIN_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NetworkPolicyRuleWithinClient) List(opts *ListOpts) (*NetworkPolicyRuleWithinCollection, error) { + resp := &NetworkPolicyRuleWithinCollection{} + err := c.rancherClient.doList(NETWORK_POLICY_RULE_WITHIN_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NetworkPolicyRuleWithinCollection) Next() (*NetworkPolicyRuleWithinCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NetworkPolicyRuleWithinCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NetworkPolicyRuleWithinClient) ById(id string) (*NetworkPolicyRuleWithin, error) { + resp := &NetworkPolicyRuleWithin{} + err := c.rancherClient.doById(NETWORK_POLICY_RULE_WITHIN_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NetworkPolicyRuleWithinClient) Delete(container *NetworkPolicyRuleWithin) error { + return c.rancherClient.doResourceDelete(NETWORK_POLICY_RULE_WITHIN_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_nfs_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_nfs_config.go new file mode 100644 index 0000000000..1c0143fbf0 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_nfs_config.go @@ -0,0 +1,83 @@ +package client + +const ( + NFS_CONFIG_TYPE = "nfsConfig" +) + +type NfsConfig struct { + Resource + + MountOptions string `json:"mountOptions,omitempty" yaml:"mount_options,omitempty"` + + Server string `json:"server,omitempty" yaml:"server,omitempty"` + + Share string `json:"share,omitempty" yaml:"share,omitempty"` +} + +type NfsConfigCollection struct { + Collection + Data []NfsConfig `json:"data,omitempty"` + client *NfsConfigClient +} + +type NfsConfigClient struct { + rancherClient *RancherClient +} + +type NfsConfigOperations interface { + List(opts *ListOpts) (*NfsConfigCollection, error) + Create(opts *NfsConfig) (*NfsConfig, error) + Update(existing *NfsConfig, updates interface{}) (*NfsConfig, error) + ById(id string) (*NfsConfig, error) + Delete(container *NfsConfig) error +} + +func newNfsConfigClient(rancherClient *RancherClient) *NfsConfigClient { + return &NfsConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *NfsConfigClient) Create(container *NfsConfig) (*NfsConfig, error) { + resp := &NfsConfig{} + err := c.rancherClient.doCreate(NFS_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *NfsConfigClient) Update(existing *NfsConfig, updates interface{}) (*NfsConfig, error) { + resp := &NfsConfig{} + err := c.rancherClient.doUpdate(NFS_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *NfsConfigClient) List(opts *ListOpts) (*NfsConfigCollection, error) { + resp := &NfsConfigCollection{} + err := c.rancherClient.doList(NFS_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *NfsConfigCollection) Next() (*NfsConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &NfsConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *NfsConfigClient) ById(id string) (*NfsConfig, error) { + resp := &NfsConfig{} + err := c.rancherClient.doById(NFS_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *NfsConfigClient) Delete(container *NfsConfig) error { + return c.rancherClient.doResourceDelete(NFS_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_openldapconfig.go b/vendor/github.com/rancher/go-rancher/v2/generated_openldapconfig.go new file mode 100644 index 0000000000..baf672aedb --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_openldapconfig.go @@ -0,0 +1,129 @@ +package client + +const ( + OPENLDAPCONFIG_TYPE = "openldapconfig" +) + +type Openldapconfig struct { + Resource + + AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"` + + AllowedIdentities []Identity `json:"allowedIdentities,omitempty" yaml:"allowed_identities,omitempty"` + + ConnectionTimeout int64 `json:"connectionTimeout,omitempty" yaml:"connection_timeout,omitempty"` + + Domain string `json:"domain,omitempty" yaml:"domain,omitempty"` + + Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` + + GroupDNField string `json:"groupDNField,omitempty" yaml:"group_dnfield,omitempty"` + + GroupMemberMappingAttribute string `json:"groupMemberMappingAttribute,omitempty" yaml:"group_member_mapping_attribute,omitempty"` + + GroupMemberUserAttribute string `json:"groupMemberUserAttribute,omitempty" yaml:"group_member_user_attribute,omitempty"` + + GroupNameField string `json:"groupNameField,omitempty" yaml:"group_name_field,omitempty"` + + GroupObjectClass string `json:"groupObjectClass,omitempty" yaml:"group_object_class,omitempty"` + + GroupSearchDomain string `json:"groupSearchDomain,omitempty" yaml:"group_search_domain,omitempty"` + + GroupSearchField string `json:"groupSearchField,omitempty" yaml:"group_search_field,omitempty"` + + LoginDomain string `json:"loginDomain,omitempty" yaml:"login_domain,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + + Server string `json:"server,omitempty" yaml:"server,omitempty"` + + ServiceAccountPassword string `json:"serviceAccountPassword,omitempty" yaml:"service_account_password,omitempty"` + + ServiceAccountUsername string `json:"serviceAccountUsername,omitempty" yaml:"service_account_username,omitempty"` + + Tls bool `json:"tls,omitempty" yaml:"tls,omitempty"` + + UserDisabledBitMask int64 `json:"userDisabledBitMask,omitempty" yaml:"user_disabled_bit_mask,omitempty"` + + UserEnabledAttribute string `json:"userEnabledAttribute,omitempty" yaml:"user_enabled_attribute,omitempty"` + + UserLoginField string `json:"userLoginField,omitempty" yaml:"user_login_field,omitempty"` + + UserMemberAttribute string `json:"userMemberAttribute,omitempty" yaml:"user_member_attribute,omitempty"` + + UserNameField string `json:"userNameField,omitempty" yaml:"user_name_field,omitempty"` + + UserObjectClass string `json:"userObjectClass,omitempty" yaml:"user_object_class,omitempty"` + + UserSearchField string `json:"userSearchField,omitempty" yaml:"user_search_field,omitempty"` +} + +type OpenldapconfigCollection struct { + Collection + Data []Openldapconfig `json:"data,omitempty"` + client *OpenldapconfigClient +} + +type OpenldapconfigClient struct { + rancherClient *RancherClient +} + +type OpenldapconfigOperations interface { + List(opts *ListOpts) (*OpenldapconfigCollection, error) + Create(opts *Openldapconfig) (*Openldapconfig, error) + Update(existing *Openldapconfig, updates interface{}) (*Openldapconfig, error) + ById(id string) (*Openldapconfig, error) + Delete(container *Openldapconfig) error +} + +func newOpenldapconfigClient(rancherClient *RancherClient) *OpenldapconfigClient { + return &OpenldapconfigClient{ + rancherClient: rancherClient, + } +} + +func (c *OpenldapconfigClient) Create(container *Openldapconfig) (*Openldapconfig, error) { + resp := &Openldapconfig{} + err := c.rancherClient.doCreate(OPENLDAPCONFIG_TYPE, container, resp) + return resp, err +} + +func (c *OpenldapconfigClient) Update(existing *Openldapconfig, updates interface{}) (*Openldapconfig, error) { + resp := &Openldapconfig{} + err := c.rancherClient.doUpdate(OPENLDAPCONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *OpenldapconfigClient) List(opts *ListOpts) (*OpenldapconfigCollection, error) { + resp := &OpenldapconfigCollection{} + err := c.rancherClient.doList(OPENLDAPCONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *OpenldapconfigCollection) Next() (*OpenldapconfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &OpenldapconfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *OpenldapconfigClient) ById(id string) (*Openldapconfig, error) { + resp := &Openldapconfig{} + err := c.rancherClient.doById(OPENLDAPCONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *OpenldapconfigClient) Delete(container *Openldapconfig) error { + return c.rancherClient.doResourceDelete(OPENLDAPCONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_packet_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_packet_config.go new file mode 100644 index 0000000000..3f3c4ff31f --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_packet_config.go @@ -0,0 +1,89 @@ +package client + +const ( + PACKET_CONFIG_TYPE = "packetConfig" +) + +type PacketConfig struct { + Resource + + ApiKey string `json:"apiKey,omitempty" yaml:"api_key,omitempty"` + + BillingCycle string `json:"billingCycle,omitempty" yaml:"billing_cycle,omitempty"` + + FacilityCode string `json:"facilityCode,omitempty" yaml:"facility_code,omitempty"` + + Os string `json:"os,omitempty" yaml:"os,omitempty"` + + Plan string `json:"plan,omitempty" yaml:"plan,omitempty"` + + ProjectId string `json:"projectId,omitempty" yaml:"project_id,omitempty"` +} + +type PacketConfigCollection struct { + Collection + Data []PacketConfig `json:"data,omitempty"` + client *PacketConfigClient +} + +type PacketConfigClient struct { + rancherClient *RancherClient +} + +type PacketConfigOperations interface { + List(opts *ListOpts) (*PacketConfigCollection, error) + Create(opts *PacketConfig) (*PacketConfig, error) + Update(existing *PacketConfig, updates interface{}) (*PacketConfig, error) + ById(id string) (*PacketConfig, error) + Delete(container *PacketConfig) error +} + +func newPacketConfigClient(rancherClient *RancherClient) *PacketConfigClient { + return &PacketConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *PacketConfigClient) Create(container *PacketConfig) (*PacketConfig, error) { + resp := &PacketConfig{} + err := c.rancherClient.doCreate(PACKET_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *PacketConfigClient) Update(existing *PacketConfig, updates interface{}) (*PacketConfig, error) { + resp := &PacketConfig{} + err := c.rancherClient.doUpdate(PACKET_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PacketConfigClient) List(opts *ListOpts) (*PacketConfigCollection, error) { + resp := &PacketConfigCollection{} + err := c.rancherClient.doList(PACKET_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PacketConfigCollection) Next() (*PacketConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PacketConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PacketConfigClient) ById(id string) (*PacketConfig, error) { + resp := &PacketConfig{} + err := c.rancherClient.doById(PACKET_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PacketConfigClient) Delete(container *PacketConfig) error { + return c.rancherClient.doResourceDelete(PACKET_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_password.go b/vendor/github.com/rancher/go-rancher/v2/generated_password.go new file mode 100644 index 0000000000..5fb0d358db --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_password.go @@ -0,0 +1,184 @@ +package client + +const ( + PASSWORD_TYPE = "password" +) + +type Password struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicValue string `json:"publicValue,omitempty" yaml:"public_value,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SecretValue string `json:"secretValue,omitempty" yaml:"secret_value,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type PasswordCollection struct { + Collection + Data []Password `json:"data,omitempty"` + client *PasswordClient +} + +type PasswordClient struct { + rancherClient *RancherClient +} + +type PasswordOperations interface { + List(opts *ListOpts) (*PasswordCollection, error) + Create(opts *Password) (*Password, error) + Update(existing *Password, updates interface{}) (*Password, error) + ById(id string) (*Password, error) + Delete(container *Password) error + + ActionActivate(*Password) (*Credential, error) + + ActionChangesecret(*Password, *ChangeSecretInput) (*ChangeSecretInput, error) + + ActionCreate(*Password) (*Credential, error) + + ActionDeactivate(*Password) (*Credential, error) + + ActionPurge(*Password) (*Credential, error) + + ActionRemove(*Password) (*Credential, error) + + ActionUpdate(*Password) (*Credential, error) +} + +func newPasswordClient(rancherClient *RancherClient) *PasswordClient { + return &PasswordClient{ + rancherClient: rancherClient, + } +} + +func (c *PasswordClient) Create(container *Password) (*Password, error) { + resp := &Password{} + err := c.rancherClient.doCreate(PASSWORD_TYPE, container, resp) + return resp, err +} + +func (c *PasswordClient) Update(existing *Password, updates interface{}) (*Password, error) { + resp := &Password{} + err := c.rancherClient.doUpdate(PASSWORD_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PasswordClient) List(opts *ListOpts) (*PasswordCollection, error) { + resp := &PasswordCollection{} + err := c.rancherClient.doList(PASSWORD_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PasswordCollection) Next() (*PasswordCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PasswordCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PasswordClient) ById(id string) (*Password, error) { + resp := &Password{} + err := c.rancherClient.doById(PASSWORD_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PasswordClient) Delete(container *Password) error { + return c.rancherClient.doResourceDelete(PASSWORD_TYPE, &container.Resource) +} + +func (c *PasswordClient) ActionActivate(resource *Password) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PasswordClient) ActionChangesecret(resource *Password, input *ChangeSecretInput) (*ChangeSecretInput, error) { + + resp := &ChangeSecretInput{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "changesecret", &resource.Resource, input, resp) + + return resp, err +} + +func (c *PasswordClient) ActionCreate(resource *Password) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PasswordClient) ActionDeactivate(resource *Password) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PasswordClient) ActionPurge(resource *Password) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PasswordClient) ActionRemove(resource *Password) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PasswordClient) ActionUpdate(resource *Password) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(PASSWORD_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_physical_host.go b/vendor/github.com/rancher/go-rancher/v2/generated_physical_host.go new file mode 100644 index 0000000000..30039c4902 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_physical_host.go @@ -0,0 +1,162 @@ +package client + +const ( + PHYSICAL_HOST_TYPE = "physicalHost" +) + +type PhysicalHost struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type PhysicalHostCollection struct { + Collection + Data []PhysicalHost `json:"data,omitempty"` + client *PhysicalHostClient +} + +type PhysicalHostClient struct { + rancherClient *RancherClient +} + +type PhysicalHostOperations interface { + List(opts *ListOpts) (*PhysicalHostCollection, error) + Create(opts *PhysicalHost) (*PhysicalHost, error) + Update(existing *PhysicalHost, updates interface{}) (*PhysicalHost, error) + ById(id string) (*PhysicalHost, error) + Delete(container *PhysicalHost) error + + ActionBootstrap(*PhysicalHost) (*PhysicalHost, error) + + ActionCreate(*PhysicalHost) (*PhysicalHost, error) + + ActionError(*PhysicalHost) (*PhysicalHost, error) + + ActionRemove(*PhysicalHost) (*PhysicalHost, error) + + ActionUpdate(*PhysicalHost) (*PhysicalHost, error) +} + +func newPhysicalHostClient(rancherClient *RancherClient) *PhysicalHostClient { + return &PhysicalHostClient{ + rancherClient: rancherClient, + } +} + +func (c *PhysicalHostClient) Create(container *PhysicalHost) (*PhysicalHost, error) { + resp := &PhysicalHost{} + err := c.rancherClient.doCreate(PHYSICAL_HOST_TYPE, container, resp) + return resp, err +} + +func (c *PhysicalHostClient) Update(existing *PhysicalHost, updates interface{}) (*PhysicalHost, error) { + resp := &PhysicalHost{} + err := c.rancherClient.doUpdate(PHYSICAL_HOST_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PhysicalHostClient) List(opts *ListOpts) (*PhysicalHostCollection, error) { + resp := &PhysicalHostCollection{} + err := c.rancherClient.doList(PHYSICAL_HOST_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PhysicalHostCollection) Next() (*PhysicalHostCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PhysicalHostCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PhysicalHostClient) ById(id string) (*PhysicalHost, error) { + resp := &PhysicalHost{} + err := c.rancherClient.doById(PHYSICAL_HOST_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PhysicalHostClient) Delete(container *PhysicalHost) error { + return c.rancherClient.doResourceDelete(PHYSICAL_HOST_TYPE, &container.Resource) +} + +func (c *PhysicalHostClient) ActionBootstrap(resource *PhysicalHost) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(PHYSICAL_HOST_TYPE, "bootstrap", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PhysicalHostClient) ActionCreate(resource *PhysicalHost) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(PHYSICAL_HOST_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PhysicalHostClient) ActionError(resource *PhysicalHost) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(PHYSICAL_HOST_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PhysicalHostClient) ActionRemove(resource *PhysicalHost) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(PHYSICAL_HOST_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PhysicalHostClient) ActionUpdate(resource *PhysicalHost) (*PhysicalHost, error) { + + resp := &PhysicalHost{} + + err := c.rancherClient.doAction(PHYSICAL_HOST_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_port.go b/vendor/github.com/rancher/go-rancher/v2/generated_port.go new file mode 100644 index 0000000000..1d7a1a977c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_port.go @@ -0,0 +1,183 @@ +package client + +const ( + PORT_TYPE = "port" +) + +type Port struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + BindAddress string `json:"bindAddress,omitempty" yaml:"bind_address,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PrivateIpAddressId string `json:"privateIpAddressId,omitempty" yaml:"private_ip_address_id,omitempty"` + + PrivatePort int64 `json:"privatePort,omitempty" yaml:"private_port,omitempty"` + + Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"` + + PublicIpAddressId string `json:"publicIpAddressId,omitempty" yaml:"public_ip_address_id,omitempty"` + + PublicPort int64 `json:"publicPort,omitempty" yaml:"public_port,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type PortCollection struct { + Collection + Data []Port `json:"data,omitempty"` + client *PortClient +} + +type PortClient struct { + rancherClient *RancherClient +} + +type PortOperations interface { + List(opts *ListOpts) (*PortCollection, error) + Create(opts *Port) (*Port, error) + Update(existing *Port, updates interface{}) (*Port, error) + ById(id string) (*Port, error) + Delete(container *Port) error + + ActionActivate(*Port) (*Port, error) + + ActionCreate(*Port) (*Port, error) + + ActionDeactivate(*Port) (*Port, error) + + ActionPurge(*Port) (*Port, error) + + ActionRemove(*Port) (*Port, error) + + ActionUpdate(*Port) (*Port, error) +} + +func newPortClient(rancherClient *RancherClient) *PortClient { + return &PortClient{ + rancherClient: rancherClient, + } +} + +func (c *PortClient) Create(container *Port) (*Port, error) { + resp := &Port{} + err := c.rancherClient.doCreate(PORT_TYPE, container, resp) + return resp, err +} + +func (c *PortClient) Update(existing *Port, updates interface{}) (*Port, error) { + resp := &Port{} + err := c.rancherClient.doUpdate(PORT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PortClient) List(opts *ListOpts) (*PortCollection, error) { + resp := &PortCollection{} + err := c.rancherClient.doList(PORT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PortCollection) Next() (*PortCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PortCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PortClient) ById(id string) (*Port, error) { + resp := &Port{} + err := c.rancherClient.doById(PORT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PortClient) Delete(container *Port) error { + return c.rancherClient.doResourceDelete(PORT_TYPE, &container.Resource) +} + +func (c *PortClient) ActionActivate(resource *Port) (*Port, error) { + + resp := &Port{} + + err := c.rancherClient.doAction(PORT_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PortClient) ActionCreate(resource *Port) (*Port, error) { + + resp := &Port{} + + err := c.rancherClient.doAction(PORT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PortClient) ActionDeactivate(resource *Port) (*Port, error) { + + resp := &Port{} + + err := c.rancherClient.doAction(PORT_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PortClient) ActionPurge(resource *Port) (*Port, error) { + + resp := &Port{} + + err := c.rancherClient.doAction(PORT_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PortClient) ActionRemove(resource *Port) (*Port, error) { + + resp := &Port{} + + err := c.rancherClient.doAction(PORT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PortClient) ActionUpdate(resource *Port) (*Port, error) { + + resp := &Port{} + + err := c.rancherClient.doAction(PORT_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_port_rule.go b/vendor/github.com/rancher/go-rancher/v2/generated_port_rule.go new file mode 100644 index 0000000000..92ed2012ea --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_port_rule.go @@ -0,0 +1,101 @@ +package client + +const ( + PORT_RULE_TYPE = "portRule" +) + +type PortRule struct { + Resource `yaml:"-"` + + BackendName string `json:"backendName,omitempty" yaml:"backend_name,omitempty"` + + Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + Path string `json:"path,omitempty" yaml:"path,omitempty"` + + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + + Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"` + + Region string `json:"region,omitempty" yaml:"region,omitempty"` + + Selector string `json:"selector,omitempty" yaml:"selector,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + SourcePort int64 `json:"sourcePort,omitempty" yaml:"source_port,omitempty"` + + TargetPort int64 `json:"targetPort,omitempty" yaml:"target_port,omitempty"` + + Weight int64 `json:"weight,omitempty" yaml:"weight,omitempty"` +} + +type PortRuleCollection struct { + Collection + Data []PortRule `json:"data,omitempty"` + client *PortRuleClient +} + +type PortRuleClient struct { + rancherClient *RancherClient +} + +type PortRuleOperations interface { + List(opts *ListOpts) (*PortRuleCollection, error) + Create(opts *PortRule) (*PortRule, error) + Update(existing *PortRule, updates interface{}) (*PortRule, error) + ById(id string) (*PortRule, error) + Delete(container *PortRule) error +} + +func newPortRuleClient(rancherClient *RancherClient) *PortRuleClient { + return &PortRuleClient{ + rancherClient: rancherClient, + } +} + +func (c *PortRuleClient) Create(container *PortRule) (*PortRule, error) { + resp := &PortRule{} + err := c.rancherClient.doCreate(PORT_RULE_TYPE, container, resp) + return resp, err +} + +func (c *PortRuleClient) Update(existing *PortRule, updates interface{}) (*PortRule, error) { + resp := &PortRule{} + err := c.rancherClient.doUpdate(PORT_RULE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PortRuleClient) List(opts *ListOpts) (*PortRuleCollection, error) { + resp := &PortRuleCollection{} + err := c.rancherClient.doList(PORT_RULE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PortRuleCollection) Next() (*PortRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PortRuleCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PortRuleClient) ById(id string) (*PortRule, error) { + resp := &PortRule{} + err := c.rancherClient.doById(PORT_RULE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PortRuleClient) Delete(container *PortRule) error { + return c.rancherClient.doResourceDelete(PORT_RULE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_process_definition.go b/vendor/github.com/rancher/go-rancher/v2/generated_process_definition.go new file mode 100644 index 0000000000..9da63d81f2 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_process_definition.go @@ -0,0 +1,91 @@ +package client + +const ( + PROCESS_DEFINITION_TYPE = "processDefinition" +) + +type ProcessDefinition struct { + Resource + + ExtensionBased bool `json:"extensionBased,omitempty" yaml:"extension_based,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PostProcessListeners interface{} `json:"postProcessListeners,omitempty" yaml:"post_process_listeners,omitempty"` + + PreProcessListeners interface{} `json:"preProcessListeners,omitempty" yaml:"pre_process_listeners,omitempty"` + + ProcessHandlers interface{} `json:"processHandlers,omitempty" yaml:"process_handlers,omitempty"` + + ResourceType string `json:"resourceType,omitempty" yaml:"resource_type,omitempty"` + + StateTransitions []StateTransition `json:"stateTransitions,omitempty" yaml:"state_transitions,omitempty"` +} + +type ProcessDefinitionCollection struct { + Collection + Data []ProcessDefinition `json:"data,omitempty"` + client *ProcessDefinitionClient +} + +type ProcessDefinitionClient struct { + rancherClient *RancherClient +} + +type ProcessDefinitionOperations interface { + List(opts *ListOpts) (*ProcessDefinitionCollection, error) + Create(opts *ProcessDefinition) (*ProcessDefinition, error) + Update(existing *ProcessDefinition, updates interface{}) (*ProcessDefinition, error) + ById(id string) (*ProcessDefinition, error) + Delete(container *ProcessDefinition) error +} + +func newProcessDefinitionClient(rancherClient *RancherClient) *ProcessDefinitionClient { + return &ProcessDefinitionClient{ + rancherClient: rancherClient, + } +} + +func (c *ProcessDefinitionClient) Create(container *ProcessDefinition) (*ProcessDefinition, error) { + resp := &ProcessDefinition{} + err := c.rancherClient.doCreate(PROCESS_DEFINITION_TYPE, container, resp) + return resp, err +} + +func (c *ProcessDefinitionClient) Update(existing *ProcessDefinition, updates interface{}) (*ProcessDefinition, error) { + resp := &ProcessDefinition{} + err := c.rancherClient.doUpdate(PROCESS_DEFINITION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProcessDefinitionClient) List(opts *ListOpts) (*ProcessDefinitionCollection, error) { + resp := &ProcessDefinitionCollection{} + err := c.rancherClient.doList(PROCESS_DEFINITION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProcessDefinitionCollection) Next() (*ProcessDefinitionCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProcessDefinitionCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProcessDefinitionClient) ById(id string) (*ProcessDefinition, error) { + resp := &ProcessDefinition{} + err := c.rancherClient.doById(PROCESS_DEFINITION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProcessDefinitionClient) Delete(container *ProcessDefinition) error { + return c.rancherClient.doResourceDelete(PROCESS_DEFINITION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_process_execution.go b/vendor/github.com/rancher/go-rancher/v2/generated_process_execution.go new file mode 100644 index 0000000000..7356dce8d1 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_process_execution.go @@ -0,0 +1,85 @@ +package client + +const ( + PROCESS_EXECUTION_TYPE = "processExecution" +) + +type ProcessExecution struct { + Resource + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Log map[string]interface{} `json:"log,omitempty" yaml:"log,omitempty"` + + ProcessInstanceId string `json:"processInstanceId,omitempty" yaml:"process_instance_id,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ProcessExecutionCollection struct { + Collection + Data []ProcessExecution `json:"data,omitempty"` + client *ProcessExecutionClient +} + +type ProcessExecutionClient struct { + rancherClient *RancherClient +} + +type ProcessExecutionOperations interface { + List(opts *ListOpts) (*ProcessExecutionCollection, error) + Create(opts *ProcessExecution) (*ProcessExecution, error) + Update(existing *ProcessExecution, updates interface{}) (*ProcessExecution, error) + ById(id string) (*ProcessExecution, error) + Delete(container *ProcessExecution) error +} + +func newProcessExecutionClient(rancherClient *RancherClient) *ProcessExecutionClient { + return &ProcessExecutionClient{ + rancherClient: rancherClient, + } +} + +func (c *ProcessExecutionClient) Create(container *ProcessExecution) (*ProcessExecution, error) { + resp := &ProcessExecution{} + err := c.rancherClient.doCreate(PROCESS_EXECUTION_TYPE, container, resp) + return resp, err +} + +func (c *ProcessExecutionClient) Update(existing *ProcessExecution, updates interface{}) (*ProcessExecution, error) { + resp := &ProcessExecution{} + err := c.rancherClient.doUpdate(PROCESS_EXECUTION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProcessExecutionClient) List(opts *ListOpts) (*ProcessExecutionCollection, error) { + resp := &ProcessExecutionCollection{} + err := c.rancherClient.doList(PROCESS_EXECUTION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProcessExecutionCollection) Next() (*ProcessExecutionCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProcessExecutionCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProcessExecutionClient) ById(id string) (*ProcessExecution, error) { + resp := &ProcessExecution{} + err := c.rancherClient.doById(PROCESS_EXECUTION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProcessExecutionClient) Delete(container *ProcessExecution) error { + return c.rancherClient.doResourceDelete(PROCESS_EXECUTION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_process_instance.go b/vendor/github.com/rancher/go-rancher/v2/generated_process_instance.go new file mode 100644 index 0000000000..deae1af97d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_process_instance.go @@ -0,0 +1,118 @@ +package client + +const ( + PROCESS_INSTANCE_TYPE = "processInstance" +) + +type ProcessInstance struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + EndTime string `json:"endTime,omitempty" yaml:"end_time,omitempty"` + + ExecutionCount int64 `json:"executionCount,omitempty" yaml:"execution_count,omitempty"` + + ExitReason string `json:"exitReason,omitempty" yaml:"exit_reason,omitempty"` + + Phase string `json:"phase,omitempty" yaml:"phase,omitempty"` + + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + + ProcessName string `json:"processName,omitempty" yaml:"process_name,omitempty"` + + ResourceId string `json:"resourceId,omitempty" yaml:"resource_id,omitempty"` + + ResourceType string `json:"resourceType,omitempty" yaml:"resource_type,omitempty"` + + Result string `json:"result,omitempty" yaml:"result,omitempty"` + + RunAfter string `json:"runAfter,omitempty" yaml:"run_after,omitempty"` + + RunningProcessServerId string `json:"runningProcessServerId,omitempty" yaml:"running_process_server_id,omitempty"` + + StartProcessServerId string `json:"startProcessServerId,omitempty" yaml:"start_process_server_id,omitempty"` + + StartTime string `json:"startTime,omitempty" yaml:"start_time,omitempty"` +} + +type ProcessInstanceCollection struct { + Collection + Data []ProcessInstance `json:"data,omitempty"` + client *ProcessInstanceClient +} + +type ProcessInstanceClient struct { + rancherClient *RancherClient +} + +type ProcessInstanceOperations interface { + List(opts *ListOpts) (*ProcessInstanceCollection, error) + Create(opts *ProcessInstance) (*ProcessInstance, error) + Update(existing *ProcessInstance, updates interface{}) (*ProcessInstance, error) + ById(id string) (*ProcessInstance, error) + Delete(container *ProcessInstance) error + + ActionReplay(*ProcessInstance) (*ProcessInstance, error) +} + +func newProcessInstanceClient(rancherClient *RancherClient) *ProcessInstanceClient { + return &ProcessInstanceClient{ + rancherClient: rancherClient, + } +} + +func (c *ProcessInstanceClient) Create(container *ProcessInstance) (*ProcessInstance, error) { + resp := &ProcessInstance{} + err := c.rancherClient.doCreate(PROCESS_INSTANCE_TYPE, container, resp) + return resp, err +} + +func (c *ProcessInstanceClient) Update(existing *ProcessInstance, updates interface{}) (*ProcessInstance, error) { + resp := &ProcessInstance{} + err := c.rancherClient.doUpdate(PROCESS_INSTANCE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProcessInstanceClient) List(opts *ListOpts) (*ProcessInstanceCollection, error) { + resp := &ProcessInstanceCollection{} + err := c.rancherClient.doList(PROCESS_INSTANCE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProcessInstanceCollection) Next() (*ProcessInstanceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProcessInstanceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProcessInstanceClient) ById(id string) (*ProcessInstance, error) { + resp := &ProcessInstance{} + err := c.rancherClient.doById(PROCESS_INSTANCE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProcessInstanceClient) Delete(container *ProcessInstance) error { + return c.rancherClient.doResourceDelete(PROCESS_INSTANCE_TYPE, &container.Resource) +} + +func (c *ProcessInstanceClient) ActionReplay(resource *ProcessInstance) (*ProcessInstance, error) { + + resp := &ProcessInstance{} + + err := c.rancherClient.doAction(PROCESS_INSTANCE_TYPE, "replay", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_process_pool.go b/vendor/github.com/rancher/go-rancher/v2/generated_process_pool.go new file mode 100644 index 0000000000..1fbff0b0fc --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_process_pool.go @@ -0,0 +1,95 @@ +package client + +const ( + PROCESS_POOL_TYPE = "processPool" +) + +type ProcessPool struct { + Resource + + ActiveTasks int64 `json:"activeTasks,omitempty" yaml:"active_tasks,omitempty"` + + CompletedTasks int64 `json:"completedTasks,omitempty" yaml:"completed_tasks,omitempty"` + + MaxPoolSize int64 `json:"maxPoolSize,omitempty" yaml:"max_pool_size,omitempty"` + + MinPoolSize int64 `json:"minPoolSize,omitempty" yaml:"min_pool_size,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PoolSize int64 `json:"poolSize,omitempty" yaml:"pool_size,omitempty"` + + QueueRemainingCapacity int64 `json:"queueRemainingCapacity,omitempty" yaml:"queue_remaining_capacity,omitempty"` + + QueueSize int64 `json:"queueSize,omitempty" yaml:"queue_size,omitempty"` + + RejectedTasks int64 `json:"rejectedTasks,omitempty" yaml:"rejected_tasks,omitempty"` +} + +type ProcessPoolCollection struct { + Collection + Data []ProcessPool `json:"data,omitempty"` + client *ProcessPoolClient +} + +type ProcessPoolClient struct { + rancherClient *RancherClient +} + +type ProcessPoolOperations interface { + List(opts *ListOpts) (*ProcessPoolCollection, error) + Create(opts *ProcessPool) (*ProcessPool, error) + Update(existing *ProcessPool, updates interface{}) (*ProcessPool, error) + ById(id string) (*ProcessPool, error) + Delete(container *ProcessPool) error +} + +func newProcessPoolClient(rancherClient *RancherClient) *ProcessPoolClient { + return &ProcessPoolClient{ + rancherClient: rancherClient, + } +} + +func (c *ProcessPoolClient) Create(container *ProcessPool) (*ProcessPool, error) { + resp := &ProcessPool{} + err := c.rancherClient.doCreate(PROCESS_POOL_TYPE, container, resp) + return resp, err +} + +func (c *ProcessPoolClient) Update(existing *ProcessPool, updates interface{}) (*ProcessPool, error) { + resp := &ProcessPool{} + err := c.rancherClient.doUpdate(PROCESS_POOL_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProcessPoolClient) List(opts *ListOpts) (*ProcessPoolCollection, error) { + resp := &ProcessPoolCollection{} + err := c.rancherClient.doList(PROCESS_POOL_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProcessPoolCollection) Next() (*ProcessPoolCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProcessPoolCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProcessPoolClient) ById(id string) (*ProcessPool, error) { + resp := &ProcessPool{} + err := c.rancherClient.doById(PROCESS_POOL_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProcessPoolClient) Delete(container *ProcessPool) error { + return c.rancherClient.doResourceDelete(PROCESS_POOL_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_process_summary.go b/vendor/github.com/rancher/go-rancher/v2/generated_process_summary.go new file mode 100644 index 0000000000..aed14d7434 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_process_summary.go @@ -0,0 +1,85 @@ +package client + +const ( + PROCESS_SUMMARY_TYPE = "processSummary" +) + +type ProcessSummary struct { + Resource + + Delay int64 `json:"delay,omitempty" yaml:"delay,omitempty"` + + ProcessName string `json:"processName,omitempty" yaml:"process_name,omitempty"` + + Ready int64 `json:"ready,omitempty" yaml:"ready,omitempty"` + + Running int64 `json:"running,omitempty" yaml:"running,omitempty"` +} + +type ProcessSummaryCollection struct { + Collection + Data []ProcessSummary `json:"data,omitempty"` + client *ProcessSummaryClient +} + +type ProcessSummaryClient struct { + rancherClient *RancherClient +} + +type ProcessSummaryOperations interface { + List(opts *ListOpts) (*ProcessSummaryCollection, error) + Create(opts *ProcessSummary) (*ProcessSummary, error) + Update(existing *ProcessSummary, updates interface{}) (*ProcessSummary, error) + ById(id string) (*ProcessSummary, error) + Delete(container *ProcessSummary) error +} + +func newProcessSummaryClient(rancherClient *RancherClient) *ProcessSummaryClient { + return &ProcessSummaryClient{ + rancherClient: rancherClient, + } +} + +func (c *ProcessSummaryClient) Create(container *ProcessSummary) (*ProcessSummary, error) { + resp := &ProcessSummary{} + err := c.rancherClient.doCreate(PROCESS_SUMMARY_TYPE, container, resp) + return resp, err +} + +func (c *ProcessSummaryClient) Update(existing *ProcessSummary, updates interface{}) (*ProcessSummary, error) { + resp := &ProcessSummary{} + err := c.rancherClient.doUpdate(PROCESS_SUMMARY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProcessSummaryClient) List(opts *ListOpts) (*ProcessSummaryCollection, error) { + resp := &ProcessSummaryCollection{} + err := c.rancherClient.doList(PROCESS_SUMMARY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProcessSummaryCollection) Next() (*ProcessSummaryCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProcessSummaryCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProcessSummaryClient) ById(id string) (*ProcessSummary, error) { + resp := &ProcessSummary{} + err := c.rancherClient.doById(PROCESS_SUMMARY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProcessSummaryClient) Delete(container *ProcessSummary) error { + return c.rancherClient.doResourceDelete(PROCESS_SUMMARY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_project.go b/vendor/github.com/rancher/go-rancher/v2/generated_project.go new file mode 100644 index 0000000000..8abc198e63 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_project.go @@ -0,0 +1,211 @@ +package client + +const ( + PROJECT_TYPE = "project" +) + +type Project struct { + Resource + + AllowSystemRole bool `json:"allowSystemRole,omitempty" yaml:"allow_system_role,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DefaultNetworkId string `json:"defaultNetworkId,omitempty" yaml:"default_network_id,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + HostRemoveDelaySeconds int64 `json:"hostRemoveDelaySeconds,omitempty" yaml:"host_remove_delay_seconds,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Members []ProjectMember `json:"members,omitempty" yaml:"members,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Orchestration string `json:"orchestration,omitempty" yaml:"orchestration,omitempty"` + + ProjectLinks []string `json:"projectLinks,omitempty" yaml:"project_links,omitempty"` + + ProjectTemplateId string `json:"projectTemplateId,omitempty" yaml:"project_template_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServicesPortRange *ServicesPortRange `json:"servicesPortRange,omitempty" yaml:"services_port_range,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` + + VirtualMachine bool `json:"virtualMachine,omitempty" yaml:"virtual_machine,omitempty"` +} + +type ProjectCollection struct { + Collection + Data []Project `json:"data,omitempty"` + client *ProjectClient +} + +type ProjectClient struct { + rancherClient *RancherClient +} + +type ProjectOperations interface { + List(opts *ListOpts) (*ProjectCollection, error) + Create(opts *Project) (*Project, error) + Update(existing *Project, updates interface{}) (*Project, error) + ById(id string) (*Project, error) + Delete(container *Project) error + + ActionActivate(*Project) (*Account, error) + + ActionCreate(*Project) (*Account, error) + + ActionDeactivate(*Project) (*Account, error) + + ActionPurge(*Project) (*Account, error) + + ActionRemove(*Project) (*Account, error) + + ActionSetmembers(*Project, *SetProjectMembersInput) (*SetProjectMembersInput, error) + + ActionUpdate(*Project) (*Account, error) + + ActionUpgrade(*Project) (*Account, error) +} + +func newProjectClient(rancherClient *RancherClient) *ProjectClient { + return &ProjectClient{ + rancherClient: rancherClient, + } +} + +func (c *ProjectClient) Create(container *Project) (*Project, error) { + resp := &Project{} + err := c.rancherClient.doCreate(PROJECT_TYPE, container, resp) + return resp, err +} + +func (c *ProjectClient) Update(existing *Project, updates interface{}) (*Project, error) { + resp := &Project{} + err := c.rancherClient.doUpdate(PROJECT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectClient) List(opts *ListOpts) (*ProjectCollection, error) { + resp := &ProjectCollection{} + err := c.rancherClient.doList(PROJECT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectCollection) Next() (*ProjectCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectClient) ById(id string) (*Project, error) { + resp := &Project{} + err := c.rancherClient.doById(PROJECT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProjectClient) Delete(container *Project) error { + return c.rancherClient.doResourceDelete(PROJECT_TYPE, &container.Resource) +} + +func (c *ProjectClient) ActionActivate(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectClient) ActionCreate(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectClient) ActionDeactivate(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectClient) ActionPurge(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectClient) ActionRemove(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectClient) ActionSetmembers(resource *Project, input *SetProjectMembersInput) (*SetProjectMembersInput, error) { + + resp := &SetProjectMembersInput{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "setmembers", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ProjectClient) ActionUpdate(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectClient) ActionUpgrade(resource *Project) (*Account, error) { + + resp := &Account{} + + err := c.rancherClient.doAction(PROJECT_TYPE, "upgrade", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_project_member.go b/vendor/github.com/rancher/go-rancher/v2/generated_project_member.go new file mode 100644 index 0000000000..569c5a2ed0 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_project_member.go @@ -0,0 +1,175 @@ +package client + +const ( + PROJECT_MEMBER_TYPE = "projectMember" +) + +type ProjectMember struct { + Resource + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExternalIdType string `json:"externalIdType,omitempty" yaml:"external_id_type,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + ProjectId string `json:"projectId,omitempty" yaml:"project_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + Role string `json:"role,omitempty" yaml:"role,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ProjectMemberCollection struct { + Collection + Data []ProjectMember `json:"data,omitempty"` + client *ProjectMemberClient +} + +type ProjectMemberClient struct { + rancherClient *RancherClient +} + +type ProjectMemberOperations interface { + List(opts *ListOpts) (*ProjectMemberCollection, error) + Create(opts *ProjectMember) (*ProjectMember, error) + Update(existing *ProjectMember, updates interface{}) (*ProjectMember, error) + ById(id string) (*ProjectMember, error) + Delete(container *ProjectMember) error + + ActionActivate(*ProjectMember) (*ProjectMember, error) + + ActionCreate(*ProjectMember) (*ProjectMember, error) + + ActionDeactivate(*ProjectMember) (*ProjectMember, error) + + ActionPurge(*ProjectMember) (*ProjectMember, error) + + ActionRemove(*ProjectMember) (*ProjectMember, error) + + ActionUpdate(*ProjectMember) (*ProjectMember, error) +} + +func newProjectMemberClient(rancherClient *RancherClient) *ProjectMemberClient { + return &ProjectMemberClient{ + rancherClient: rancherClient, + } +} + +func (c *ProjectMemberClient) Create(container *ProjectMember) (*ProjectMember, error) { + resp := &ProjectMember{} + err := c.rancherClient.doCreate(PROJECT_MEMBER_TYPE, container, resp) + return resp, err +} + +func (c *ProjectMemberClient) Update(existing *ProjectMember, updates interface{}) (*ProjectMember, error) { + resp := &ProjectMember{} + err := c.rancherClient.doUpdate(PROJECT_MEMBER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectMemberClient) List(opts *ListOpts) (*ProjectMemberCollection, error) { + resp := &ProjectMemberCollection{} + err := c.rancherClient.doList(PROJECT_MEMBER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectMemberCollection) Next() (*ProjectMemberCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectMemberCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectMemberClient) ById(id string) (*ProjectMember, error) { + resp := &ProjectMember{} + err := c.rancherClient.doById(PROJECT_MEMBER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProjectMemberClient) Delete(container *ProjectMember) error { + return c.rancherClient.doResourceDelete(PROJECT_MEMBER_TYPE, &container.Resource) +} + +func (c *ProjectMemberClient) ActionActivate(resource *ProjectMember) (*ProjectMember, error) { + + resp := &ProjectMember{} + + err := c.rancherClient.doAction(PROJECT_MEMBER_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectMemberClient) ActionCreate(resource *ProjectMember) (*ProjectMember, error) { + + resp := &ProjectMember{} + + err := c.rancherClient.doAction(PROJECT_MEMBER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectMemberClient) ActionDeactivate(resource *ProjectMember) (*ProjectMember, error) { + + resp := &ProjectMember{} + + err := c.rancherClient.doAction(PROJECT_MEMBER_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectMemberClient) ActionPurge(resource *ProjectMember) (*ProjectMember, error) { + + resp := &ProjectMember{} + + err := c.rancherClient.doAction(PROJECT_MEMBER_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectMemberClient) ActionRemove(resource *ProjectMember) (*ProjectMember, error) { + + resp := &ProjectMember{} + + err := c.rancherClient.doAction(PROJECT_MEMBER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectMemberClient) ActionUpdate(resource *ProjectMember) (*ProjectMember, error) { + + resp := &ProjectMember{} + + err := c.rancherClient.doAction(PROJECT_MEMBER_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_project_template.go b/vendor/github.com/rancher/go-rancher/v2/generated_project_template.go new file mode 100644 index 0000000000..9c20883004 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_project_template.go @@ -0,0 +1,131 @@ +package client + +const ( + PROJECT_TEMPLATE_TYPE = "projectTemplate" +) + +type ProjectTemplate struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + IsPublic bool `json:"isPublic,omitempty" yaml:"is_public,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + Stacks []CatalogTemplate `json:"stacks,omitempty" yaml:"stacks,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ProjectTemplateCollection struct { + Collection + Data []ProjectTemplate `json:"data,omitempty"` + client *ProjectTemplateClient +} + +type ProjectTemplateClient struct { + rancherClient *RancherClient +} + +type ProjectTemplateOperations interface { + List(opts *ListOpts) (*ProjectTemplateCollection, error) + Create(opts *ProjectTemplate) (*ProjectTemplate, error) + Update(existing *ProjectTemplate, updates interface{}) (*ProjectTemplate, error) + ById(id string) (*ProjectTemplate, error) + Delete(container *ProjectTemplate) error + + ActionCreate(*ProjectTemplate) (*ProjectTemplate, error) + + ActionRemove(*ProjectTemplate) (*ProjectTemplate, error) +} + +func newProjectTemplateClient(rancherClient *RancherClient) *ProjectTemplateClient { + return &ProjectTemplateClient{ + rancherClient: rancherClient, + } +} + +func (c *ProjectTemplateClient) Create(container *ProjectTemplate) (*ProjectTemplate, error) { + resp := &ProjectTemplate{} + err := c.rancherClient.doCreate(PROJECT_TEMPLATE_TYPE, container, resp) + return resp, err +} + +func (c *ProjectTemplateClient) Update(existing *ProjectTemplate, updates interface{}) (*ProjectTemplate, error) { + resp := &ProjectTemplate{} + err := c.rancherClient.doUpdate(PROJECT_TEMPLATE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectTemplateClient) List(opts *ListOpts) (*ProjectTemplateCollection, error) { + resp := &ProjectTemplateCollection{} + err := c.rancherClient.doList(PROJECT_TEMPLATE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectTemplateCollection) Next() (*ProjectTemplateCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectTemplateCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectTemplateClient) ById(id string) (*ProjectTemplate, error) { + resp := &ProjectTemplate{} + err := c.rancherClient.doById(PROJECT_TEMPLATE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ProjectTemplateClient) Delete(container *ProjectTemplate) error { + return c.rancherClient.doResourceDelete(PROJECT_TEMPLATE_TYPE, &container.Resource) +} + +func (c *ProjectTemplateClient) ActionCreate(resource *ProjectTemplate) (*ProjectTemplate, error) { + + resp := &ProjectTemplate{} + + err := c.rancherClient.doAction(PROJECT_TEMPLATE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ProjectTemplateClient) ActionRemove(resource *ProjectTemplate) (*ProjectTemplate, error) { + + resp := &ProjectTemplate{} + + err := c.rancherClient.doAction(PROJECT_TEMPLATE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_public_endpoint.go b/vendor/github.com/rancher/go-rancher/v2/generated_public_endpoint.go new file mode 100644 index 0000000000..14898e4926 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_public_endpoint.go @@ -0,0 +1,87 @@ +package client + +const ( + PUBLIC_ENDPOINT_TYPE = "publicEndpoint" +) + +type PublicEndpoint struct { + Resource + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + IpAddress string `json:"ipAddress,omitempty" yaml:"ip_address,omitempty"` + + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` +} + +type PublicEndpointCollection struct { + Collection + Data []PublicEndpoint `json:"data,omitempty"` + client *PublicEndpointClient +} + +type PublicEndpointClient struct { + rancherClient *RancherClient +} + +type PublicEndpointOperations interface { + List(opts *ListOpts) (*PublicEndpointCollection, error) + Create(opts *PublicEndpoint) (*PublicEndpoint, error) + Update(existing *PublicEndpoint, updates interface{}) (*PublicEndpoint, error) + ById(id string) (*PublicEndpoint, error) + Delete(container *PublicEndpoint) error +} + +func newPublicEndpointClient(rancherClient *RancherClient) *PublicEndpointClient { + return &PublicEndpointClient{ + rancherClient: rancherClient, + } +} + +func (c *PublicEndpointClient) Create(container *PublicEndpoint) (*PublicEndpoint, error) { + resp := &PublicEndpoint{} + err := c.rancherClient.doCreate(PUBLIC_ENDPOINT_TYPE, container, resp) + return resp, err +} + +func (c *PublicEndpointClient) Update(existing *PublicEndpoint, updates interface{}) (*PublicEndpoint, error) { + resp := &PublicEndpoint{} + err := c.rancherClient.doUpdate(PUBLIC_ENDPOINT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PublicEndpointClient) List(opts *ListOpts) (*PublicEndpointCollection, error) { + resp := &PublicEndpointCollection{} + err := c.rancherClient.doList(PUBLIC_ENDPOINT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PublicEndpointCollection) Next() (*PublicEndpointCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PublicEndpointCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PublicEndpointClient) ById(id string) (*PublicEndpoint, error) { + resp := &PublicEndpoint{} + err := c.rancherClient.doById(PUBLIC_ENDPOINT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PublicEndpointClient) Delete(container *PublicEndpoint) error { + return c.rancherClient.doResourceDelete(PUBLIC_ENDPOINT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_publish.go b/vendor/github.com/rancher/go-rancher/v2/generated_publish.go new file mode 100644 index 0000000000..af7f7cd50b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_publish.go @@ -0,0 +1,99 @@ +package client + +const ( + PUBLISH_TYPE = "publish" +) + +type Publish struct { + Resource + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PreviousIds []string `json:"previousIds,omitempty" yaml:"previous_ids,omitempty"` + + Publisher string `json:"publisher,omitempty" yaml:"publisher,omitempty"` + + ResourceId string `json:"resourceId,omitempty" yaml:"resource_id,omitempty"` + + ResourceType string `json:"resourceType,omitempty" yaml:"resource_type,omitempty"` + + Time int64 `json:"time,omitempty" yaml:"time,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningInternalMessage string `json:"transitioningInternalMessage,omitempty" yaml:"transitioning_internal_message,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` +} + +type PublishCollection struct { + Collection + Data []Publish `json:"data,omitempty"` + client *PublishClient +} + +type PublishClient struct { + rancherClient *RancherClient +} + +type PublishOperations interface { + List(opts *ListOpts) (*PublishCollection, error) + Create(opts *Publish) (*Publish, error) + Update(existing *Publish, updates interface{}) (*Publish, error) + ById(id string) (*Publish, error) + Delete(container *Publish) error +} + +func newPublishClient(rancherClient *RancherClient) *PublishClient { + return &PublishClient{ + rancherClient: rancherClient, + } +} + +func (c *PublishClient) Create(container *Publish) (*Publish, error) { + resp := &Publish{} + err := c.rancherClient.doCreate(PUBLISH_TYPE, container, resp) + return resp, err +} + +func (c *PublishClient) Update(existing *Publish, updates interface{}) (*Publish, error) { + resp := &Publish{} + err := c.rancherClient.doUpdate(PUBLISH_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PublishClient) List(opts *ListOpts) (*PublishCollection, error) { + resp := &PublishCollection{} + err := c.rancherClient.doList(PUBLISH_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PublishCollection) Next() (*PublishCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PublishCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PublishClient) ById(id string) (*Publish, error) { + resp := &Publish{} + err := c.rancherClient.doById(PUBLISH_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PublishClient) Delete(container *Publish) error { + return c.rancherClient.doResourceDelete(PUBLISH_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_pull_task.go b/vendor/github.com/rancher/go-rancher/v2/generated_pull_task.go new file mode 100644 index 0000000000..3958091c5a --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_pull_task.go @@ -0,0 +1,133 @@ +package client + +const ( + PULL_TASK_TYPE = "pullTask" +) + +type PullTask struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Image string `json:"image,omitempty" yaml:"image,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + Mode string `json:"mode,omitempty" yaml:"mode,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Status map[string]interface{} `json:"status,omitempty" yaml:"status,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type PullTaskCollection struct { + Collection + Data []PullTask `json:"data,omitempty"` + client *PullTaskClient +} + +type PullTaskClient struct { + rancherClient *RancherClient +} + +type PullTaskOperations interface { + List(opts *ListOpts) (*PullTaskCollection, error) + Create(opts *PullTask) (*PullTask, error) + Update(existing *PullTask, updates interface{}) (*PullTask, error) + ById(id string) (*PullTask, error) + Delete(container *PullTask) error + + ActionCreate(*PullTask) (*GenericObject, error) + + ActionRemove(*PullTask) (*GenericObject, error) +} + +func newPullTaskClient(rancherClient *RancherClient) *PullTaskClient { + return &PullTaskClient{ + rancherClient: rancherClient, + } +} + +func (c *PullTaskClient) Create(container *PullTask) (*PullTask, error) { + resp := &PullTask{} + err := c.rancherClient.doCreate(PULL_TASK_TYPE, container, resp) + return resp, err +} + +func (c *PullTaskClient) Update(existing *PullTask, updates interface{}) (*PullTask, error) { + resp := &PullTask{} + err := c.rancherClient.doUpdate(PULL_TASK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PullTaskClient) List(opts *ListOpts) (*PullTaskCollection, error) { + resp := &PullTaskCollection{} + err := c.rancherClient.doList(PULL_TASK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PullTaskCollection) Next() (*PullTaskCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PullTaskCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PullTaskClient) ById(id string) (*PullTask, error) { + resp := &PullTask{} + err := c.rancherClient.doById(PULL_TASK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *PullTaskClient) Delete(container *PullTask) error { + return c.rancherClient.doResourceDelete(PULL_TASK_TYPE, &container.Resource) +} + +func (c *PullTaskClient) ActionCreate(resource *PullTask) (*GenericObject, error) { + + resp := &GenericObject{} + + err := c.rancherClient.doAction(PULL_TASK_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *PullTaskClient) ActionRemove(resource *PullTask) (*GenericObject, error) { + + resp := &GenericObject{} + + err := c.rancherClient.doAction(PULL_TASK_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_recreate_on_quorum_strategy_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_recreate_on_quorum_strategy_config.go new file mode 100644 index 0000000000..ad1e7189c7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_recreate_on_quorum_strategy_config.go @@ -0,0 +1,79 @@ +package client + +const ( + RECREATE_ON_QUORUM_STRATEGY_CONFIG_TYPE = "recreateOnQuorumStrategyConfig" +) + +type RecreateOnQuorumStrategyConfig struct { + Resource + + Quorum int64 `json:"quorum,omitempty" yaml:"quorum,omitempty"` +} + +type RecreateOnQuorumStrategyConfigCollection struct { + Collection + Data []RecreateOnQuorumStrategyConfig `json:"data,omitempty"` + client *RecreateOnQuorumStrategyConfigClient +} + +type RecreateOnQuorumStrategyConfigClient struct { + rancherClient *RancherClient +} + +type RecreateOnQuorumStrategyConfigOperations interface { + List(opts *ListOpts) (*RecreateOnQuorumStrategyConfigCollection, error) + Create(opts *RecreateOnQuorumStrategyConfig) (*RecreateOnQuorumStrategyConfig, error) + Update(existing *RecreateOnQuorumStrategyConfig, updates interface{}) (*RecreateOnQuorumStrategyConfig, error) + ById(id string) (*RecreateOnQuorumStrategyConfig, error) + Delete(container *RecreateOnQuorumStrategyConfig) error +} + +func newRecreateOnQuorumStrategyConfigClient(rancherClient *RancherClient) *RecreateOnQuorumStrategyConfigClient { + return &RecreateOnQuorumStrategyConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *RecreateOnQuorumStrategyConfigClient) Create(container *RecreateOnQuorumStrategyConfig) (*RecreateOnQuorumStrategyConfig, error) { + resp := &RecreateOnQuorumStrategyConfig{} + err := c.rancherClient.doCreate(RECREATE_ON_QUORUM_STRATEGY_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *RecreateOnQuorumStrategyConfigClient) Update(existing *RecreateOnQuorumStrategyConfig, updates interface{}) (*RecreateOnQuorumStrategyConfig, error) { + resp := &RecreateOnQuorumStrategyConfig{} + err := c.rancherClient.doUpdate(RECREATE_ON_QUORUM_STRATEGY_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RecreateOnQuorumStrategyConfigClient) List(opts *ListOpts) (*RecreateOnQuorumStrategyConfigCollection, error) { + resp := &RecreateOnQuorumStrategyConfigCollection{} + err := c.rancherClient.doList(RECREATE_ON_QUORUM_STRATEGY_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RecreateOnQuorumStrategyConfigCollection) Next() (*RecreateOnQuorumStrategyConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RecreateOnQuorumStrategyConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RecreateOnQuorumStrategyConfigClient) ById(id string) (*RecreateOnQuorumStrategyConfig, error) { + resp := &RecreateOnQuorumStrategyConfig{} + err := c.rancherClient.doById(RECREATE_ON_QUORUM_STRATEGY_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RecreateOnQuorumStrategyConfigClient) Delete(container *RecreateOnQuorumStrategyConfig) error { + return c.rancherClient.doResourceDelete(RECREATE_ON_QUORUM_STRATEGY_CONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_register.go b/vendor/github.com/rancher/go-rancher/v2/generated_register.go new file mode 100644 index 0000000000..abbdd80af8 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_register.go @@ -0,0 +1,144 @@ +package client + +const ( + REGISTER_TYPE = "register" +) + +type Register struct { + Resource + + AccessKey string `json:"accessKey,omitempty" yaml:"access_key,omitempty"` + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Key string `json:"key,omitempty" yaml:"key,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ResourceData map[string]interface{} `json:"resourceData,omitempty" yaml:"resource_data,omitempty"` + + SecretKey string `json:"secretKey,omitempty" yaml:"secret_key,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type RegisterCollection struct { + Collection + Data []Register `json:"data,omitempty"` + client *RegisterClient +} + +type RegisterClient struct { + rancherClient *RancherClient +} + +type RegisterOperations interface { + List(opts *ListOpts) (*RegisterCollection, error) + Create(opts *Register) (*Register, error) + Update(existing *Register, updates interface{}) (*Register, error) + ById(id string) (*Register, error) + Delete(container *Register) error + + ActionCreate(*Register) (*GenericObject, error) + + ActionRemove(*Register) (*GenericObject, error) + + ActionStop(*Register, *InstanceStop) (*Instance, error) +} + +func newRegisterClient(rancherClient *RancherClient) *RegisterClient { + return &RegisterClient{ + rancherClient: rancherClient, + } +} + +func (c *RegisterClient) Create(container *Register) (*Register, error) { + resp := &Register{} + err := c.rancherClient.doCreate(REGISTER_TYPE, container, resp) + return resp, err +} + +func (c *RegisterClient) Update(existing *Register, updates interface{}) (*Register, error) { + resp := &Register{} + err := c.rancherClient.doUpdate(REGISTER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RegisterClient) List(opts *ListOpts) (*RegisterCollection, error) { + resp := &RegisterCollection{} + err := c.rancherClient.doList(REGISTER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RegisterCollection) Next() (*RegisterCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RegisterCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RegisterClient) ById(id string) (*Register, error) { + resp := &Register{} + err := c.rancherClient.doById(REGISTER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RegisterClient) Delete(container *Register) error { + return c.rancherClient.doResourceDelete(REGISTER_TYPE, &container.Resource) +} + +func (c *RegisterClient) ActionCreate(resource *Register) (*GenericObject, error) { + + resp := &GenericObject{} + + err := c.rancherClient.doAction(REGISTER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegisterClient) ActionRemove(resource *Register) (*GenericObject, error) { + + resp := &GenericObject{} + + err := c.rancherClient.doAction(REGISTER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegisterClient) ActionStop(resource *Register, input *InstanceStop) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(REGISTER_TYPE, "stop", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_registration_token.go b/vendor/github.com/rancher/go-rancher/v2/generated_registration_token.go new file mode 100644 index 0000000000..1cbf178acd --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_registration_token.go @@ -0,0 +1,177 @@ +package client + +const ( + REGISTRATION_TOKEN_TYPE = "registrationToken" +) + +type RegistrationToken struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Command string `json:"command,omitempty" yaml:"command,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Image string `json:"image,omitempty" yaml:"image,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RegistrationUrl string `json:"registrationUrl,omitempty" yaml:"registration_url,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type RegistrationTokenCollection struct { + Collection + Data []RegistrationToken `json:"data,omitempty"` + client *RegistrationTokenClient +} + +type RegistrationTokenClient struct { + rancherClient *RancherClient +} + +type RegistrationTokenOperations interface { + List(opts *ListOpts) (*RegistrationTokenCollection, error) + Create(opts *RegistrationToken) (*RegistrationToken, error) + Update(existing *RegistrationToken, updates interface{}) (*RegistrationToken, error) + ById(id string) (*RegistrationToken, error) + Delete(container *RegistrationToken) error + + ActionActivate(*RegistrationToken) (*Credential, error) + + ActionCreate(*RegistrationToken) (*Credential, error) + + ActionDeactivate(*RegistrationToken) (*Credential, error) + + ActionPurge(*RegistrationToken) (*Credential, error) + + ActionRemove(*RegistrationToken) (*Credential, error) + + ActionUpdate(*RegistrationToken) (*Credential, error) +} + +func newRegistrationTokenClient(rancherClient *RancherClient) *RegistrationTokenClient { + return &RegistrationTokenClient{ + rancherClient: rancherClient, + } +} + +func (c *RegistrationTokenClient) Create(container *RegistrationToken) (*RegistrationToken, error) { + resp := &RegistrationToken{} + err := c.rancherClient.doCreate(REGISTRATION_TOKEN_TYPE, container, resp) + return resp, err +} + +func (c *RegistrationTokenClient) Update(existing *RegistrationToken, updates interface{}) (*RegistrationToken, error) { + resp := &RegistrationToken{} + err := c.rancherClient.doUpdate(REGISTRATION_TOKEN_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RegistrationTokenClient) List(opts *ListOpts) (*RegistrationTokenCollection, error) { + resp := &RegistrationTokenCollection{} + err := c.rancherClient.doList(REGISTRATION_TOKEN_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RegistrationTokenCollection) Next() (*RegistrationTokenCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RegistrationTokenCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RegistrationTokenClient) ById(id string) (*RegistrationToken, error) { + resp := &RegistrationToken{} + err := c.rancherClient.doById(REGISTRATION_TOKEN_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RegistrationTokenClient) Delete(container *RegistrationToken) error { + return c.rancherClient.doResourceDelete(REGISTRATION_TOKEN_TYPE, &container.Resource) +} + +func (c *RegistrationTokenClient) ActionActivate(resource *RegistrationToken) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRATION_TOKEN_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistrationTokenClient) ActionCreate(resource *RegistrationToken) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRATION_TOKEN_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistrationTokenClient) ActionDeactivate(resource *RegistrationToken) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRATION_TOKEN_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistrationTokenClient) ActionPurge(resource *RegistrationToken) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRATION_TOKEN_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistrationTokenClient) ActionRemove(resource *RegistrationToken) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRATION_TOKEN_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistrationTokenClient) ActionUpdate(resource *RegistrationToken) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRATION_TOKEN_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_registry.go b/vendor/github.com/rancher/go-rancher/v2/generated_registry.go new file mode 100644 index 0000000000..240478914b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_registry.go @@ -0,0 +1,181 @@ +package client + +const ( + REGISTRY_TYPE = "registry" +) + +type Registry struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + BlockDevicePath string `json:"blockDevicePath,omitempty" yaml:"block_device_path,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DriverName string `json:"driverName,omitempty" yaml:"driver_name,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServerAddress string `json:"serverAddress,omitempty" yaml:"server_address,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeAccessMode string `json:"volumeAccessMode,omitempty" yaml:"volume_access_mode,omitempty"` + + VolumeCapabilities []string `json:"volumeCapabilities,omitempty" yaml:"volume_capabilities,omitempty"` +} + +type RegistryCollection struct { + Collection + Data []Registry `json:"data,omitempty"` + client *RegistryClient +} + +type RegistryClient struct { + rancherClient *RancherClient +} + +type RegistryOperations interface { + List(opts *ListOpts) (*RegistryCollection, error) + Create(opts *Registry) (*Registry, error) + Update(existing *Registry, updates interface{}) (*Registry, error) + ById(id string) (*Registry, error) + Delete(container *Registry) error + + ActionActivate(*Registry) (*StoragePool, error) + + ActionCreate(*Registry) (*StoragePool, error) + + ActionDeactivate(*Registry) (*StoragePool, error) + + ActionPurge(*Registry) (*StoragePool, error) + + ActionRemove(*Registry) (*StoragePool, error) + + ActionUpdate(*Registry) (*StoragePool, error) +} + +func newRegistryClient(rancherClient *RancherClient) *RegistryClient { + return &RegistryClient{ + rancherClient: rancherClient, + } +} + +func (c *RegistryClient) Create(container *Registry) (*Registry, error) { + resp := &Registry{} + err := c.rancherClient.doCreate(REGISTRY_TYPE, container, resp) + return resp, err +} + +func (c *RegistryClient) Update(existing *Registry, updates interface{}) (*Registry, error) { + resp := &Registry{} + err := c.rancherClient.doUpdate(REGISTRY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RegistryClient) List(opts *ListOpts) (*RegistryCollection, error) { + resp := &RegistryCollection{} + err := c.rancherClient.doList(REGISTRY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RegistryCollection) Next() (*RegistryCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RegistryCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RegistryClient) ById(id string) (*Registry, error) { + resp := &Registry{} + err := c.rancherClient.doById(REGISTRY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RegistryClient) Delete(container *Registry) error { + return c.rancherClient.doResourceDelete(REGISTRY_TYPE, &container.Resource) +} + +func (c *RegistryClient) ActionActivate(resource *Registry) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(REGISTRY_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryClient) ActionCreate(resource *Registry) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(REGISTRY_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryClient) ActionDeactivate(resource *Registry) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(REGISTRY_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryClient) ActionPurge(resource *Registry) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(REGISTRY_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryClient) ActionRemove(resource *Registry) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(REGISTRY_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryClient) ActionUpdate(resource *Registry) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(REGISTRY_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_registry_credential.go b/vendor/github.com/rancher/go-rancher/v2/generated_registry_credential.go new file mode 100644 index 0000000000..381fcd7292 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_registry_credential.go @@ -0,0 +1,175 @@ +package client + +const ( + REGISTRY_CREDENTIAL_TYPE = "registryCredential" +) + +type RegistryCredential struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicValue string `json:"publicValue,omitempty" yaml:"public_value,omitempty"` + + RegistryId string `json:"registryId,omitempty" yaml:"registry_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SecretValue string `json:"secretValue,omitempty" yaml:"secret_value,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type RegistryCredentialCollection struct { + Collection + Data []RegistryCredential `json:"data,omitempty"` + client *RegistryCredentialClient +} + +type RegistryCredentialClient struct { + rancherClient *RancherClient +} + +type RegistryCredentialOperations interface { + List(opts *ListOpts) (*RegistryCredentialCollection, error) + Create(opts *RegistryCredential) (*RegistryCredential, error) + Update(existing *RegistryCredential, updates interface{}) (*RegistryCredential, error) + ById(id string) (*RegistryCredential, error) + Delete(container *RegistryCredential) error + + ActionActivate(*RegistryCredential) (*Credential, error) + + ActionCreate(*RegistryCredential) (*Credential, error) + + ActionDeactivate(*RegistryCredential) (*Credential, error) + + ActionPurge(*RegistryCredential) (*Credential, error) + + ActionRemove(*RegistryCredential) (*Credential, error) + + ActionUpdate(*RegistryCredential) (*Credential, error) +} + +func newRegistryCredentialClient(rancherClient *RancherClient) *RegistryCredentialClient { + return &RegistryCredentialClient{ + rancherClient: rancherClient, + } +} + +func (c *RegistryCredentialClient) Create(container *RegistryCredential) (*RegistryCredential, error) { + resp := &RegistryCredential{} + err := c.rancherClient.doCreate(REGISTRY_CREDENTIAL_TYPE, container, resp) + return resp, err +} + +func (c *RegistryCredentialClient) Update(existing *RegistryCredential, updates interface{}) (*RegistryCredential, error) { + resp := &RegistryCredential{} + err := c.rancherClient.doUpdate(REGISTRY_CREDENTIAL_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RegistryCredentialClient) List(opts *ListOpts) (*RegistryCredentialCollection, error) { + resp := &RegistryCredentialCollection{} + err := c.rancherClient.doList(REGISTRY_CREDENTIAL_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RegistryCredentialCollection) Next() (*RegistryCredentialCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RegistryCredentialCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RegistryCredentialClient) ById(id string) (*RegistryCredential, error) { + resp := &RegistryCredential{} + err := c.rancherClient.doById(REGISTRY_CREDENTIAL_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RegistryCredentialClient) Delete(container *RegistryCredential) error { + return c.rancherClient.doResourceDelete(REGISTRY_CREDENTIAL_TYPE, &container.Resource) +} + +func (c *RegistryCredentialClient) ActionActivate(resource *RegistryCredential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRY_CREDENTIAL_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryCredentialClient) ActionCreate(resource *RegistryCredential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRY_CREDENTIAL_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryCredentialClient) ActionDeactivate(resource *RegistryCredential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRY_CREDENTIAL_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryCredentialClient) ActionPurge(resource *RegistryCredential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRY_CREDENTIAL_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryCredentialClient) ActionRemove(resource *RegistryCredential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRY_CREDENTIAL_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *RegistryCredentialClient) ActionUpdate(resource *RegistryCredential) (*Credential, error) { + + resp := &Credential{} + + err := c.rancherClient.doAction(REGISTRY_CREDENTIAL_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_resource_definition.go b/vendor/github.com/rancher/go-rancher/v2/generated_resource_definition.go new file mode 100644 index 0000000000..bc65daab20 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_resource_definition.go @@ -0,0 +1,79 @@ +package client + +const ( + RESOURCE_DEFINITION_TYPE = "resourceDefinition" +) + +type ResourceDefinition struct { + Resource + + Name string `json:"name,omitempty" yaml:"name,omitempty"` +} + +type ResourceDefinitionCollection struct { + Collection + Data []ResourceDefinition `json:"data,omitempty"` + client *ResourceDefinitionClient +} + +type ResourceDefinitionClient struct { + rancherClient *RancherClient +} + +type ResourceDefinitionOperations interface { + List(opts *ListOpts) (*ResourceDefinitionCollection, error) + Create(opts *ResourceDefinition) (*ResourceDefinition, error) + Update(existing *ResourceDefinition, updates interface{}) (*ResourceDefinition, error) + ById(id string) (*ResourceDefinition, error) + Delete(container *ResourceDefinition) error +} + +func newResourceDefinitionClient(rancherClient *RancherClient) *ResourceDefinitionClient { + return &ResourceDefinitionClient{ + rancherClient: rancherClient, + } +} + +func (c *ResourceDefinitionClient) Create(container *ResourceDefinition) (*ResourceDefinition, error) { + resp := &ResourceDefinition{} + err := c.rancherClient.doCreate(RESOURCE_DEFINITION_TYPE, container, resp) + return resp, err +} + +func (c *ResourceDefinitionClient) Update(existing *ResourceDefinition, updates interface{}) (*ResourceDefinition, error) { + resp := &ResourceDefinition{} + err := c.rancherClient.doUpdate(RESOURCE_DEFINITION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ResourceDefinitionClient) List(opts *ListOpts) (*ResourceDefinitionCollection, error) { + resp := &ResourceDefinitionCollection{} + err := c.rancherClient.doList(RESOURCE_DEFINITION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ResourceDefinitionCollection) Next() (*ResourceDefinitionCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ResourceDefinitionCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ResourceDefinitionClient) ById(id string) (*ResourceDefinition, error) { + resp := &ResourceDefinition{} + err := c.rancherClient.doById(RESOURCE_DEFINITION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ResourceDefinitionClient) Delete(container *ResourceDefinition) error { + return c.rancherClient.doResourceDelete(RESOURCE_DEFINITION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_restart_policy.go b/vendor/github.com/rancher/go-rancher/v2/generated_restart_policy.go new file mode 100644 index 0000000000..23c4d81faa --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_restart_policy.go @@ -0,0 +1,81 @@ +package client + +const ( + RESTART_POLICY_TYPE = "restartPolicy" +) + +type RestartPolicy struct { + Resource + + MaximumRetryCount int64 `json:"maximumRetryCount,omitempty" yaml:"maximum_retry_count,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` +} + +type RestartPolicyCollection struct { + Collection + Data []RestartPolicy `json:"data,omitempty"` + client *RestartPolicyClient +} + +type RestartPolicyClient struct { + rancherClient *RancherClient +} + +type RestartPolicyOperations interface { + List(opts *ListOpts) (*RestartPolicyCollection, error) + Create(opts *RestartPolicy) (*RestartPolicy, error) + Update(existing *RestartPolicy, updates interface{}) (*RestartPolicy, error) + ById(id string) (*RestartPolicy, error) + Delete(container *RestartPolicy) error +} + +func newRestartPolicyClient(rancherClient *RancherClient) *RestartPolicyClient { + return &RestartPolicyClient{ + rancherClient: rancherClient, + } +} + +func (c *RestartPolicyClient) Create(container *RestartPolicy) (*RestartPolicy, error) { + resp := &RestartPolicy{} + err := c.rancherClient.doCreate(RESTART_POLICY_TYPE, container, resp) + return resp, err +} + +func (c *RestartPolicyClient) Update(existing *RestartPolicy, updates interface{}) (*RestartPolicy, error) { + resp := &RestartPolicy{} + err := c.rancherClient.doUpdate(RESTART_POLICY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RestartPolicyClient) List(opts *ListOpts) (*RestartPolicyCollection, error) { + resp := &RestartPolicyCollection{} + err := c.rancherClient.doList(RESTART_POLICY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RestartPolicyCollection) Next() (*RestartPolicyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RestartPolicyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RestartPolicyClient) ById(id string) (*RestartPolicy, error) { + resp := &RestartPolicy{} + err := c.rancherClient.doById(RESTART_POLICY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RestartPolicyClient) Delete(container *RestartPolicy) error { + return c.rancherClient.doResourceDelete(RESTART_POLICY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_restore_from_backup_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_restore_from_backup_input.go new file mode 100644 index 0000000000..f4178081a2 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_restore_from_backup_input.go @@ -0,0 +1,79 @@ +package client + +const ( + RESTORE_FROM_BACKUP_INPUT_TYPE = "restoreFromBackupInput" +) + +type RestoreFromBackupInput struct { + Resource + + BackupId string `json:"backupId,omitempty" yaml:"backup_id,omitempty"` +} + +type RestoreFromBackupInputCollection struct { + Collection + Data []RestoreFromBackupInput `json:"data,omitempty"` + client *RestoreFromBackupInputClient +} + +type RestoreFromBackupInputClient struct { + rancherClient *RancherClient +} + +type RestoreFromBackupInputOperations interface { + List(opts *ListOpts) (*RestoreFromBackupInputCollection, error) + Create(opts *RestoreFromBackupInput) (*RestoreFromBackupInput, error) + Update(existing *RestoreFromBackupInput, updates interface{}) (*RestoreFromBackupInput, error) + ById(id string) (*RestoreFromBackupInput, error) + Delete(container *RestoreFromBackupInput) error +} + +func newRestoreFromBackupInputClient(rancherClient *RancherClient) *RestoreFromBackupInputClient { + return &RestoreFromBackupInputClient{ + rancherClient: rancherClient, + } +} + +func (c *RestoreFromBackupInputClient) Create(container *RestoreFromBackupInput) (*RestoreFromBackupInput, error) { + resp := &RestoreFromBackupInput{} + err := c.rancherClient.doCreate(RESTORE_FROM_BACKUP_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *RestoreFromBackupInputClient) Update(existing *RestoreFromBackupInput, updates interface{}) (*RestoreFromBackupInput, error) { + resp := &RestoreFromBackupInput{} + err := c.rancherClient.doUpdate(RESTORE_FROM_BACKUP_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RestoreFromBackupInputClient) List(opts *ListOpts) (*RestoreFromBackupInputCollection, error) { + resp := &RestoreFromBackupInputCollection{} + err := c.rancherClient.doList(RESTORE_FROM_BACKUP_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RestoreFromBackupInputCollection) Next() (*RestoreFromBackupInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RestoreFromBackupInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RestoreFromBackupInputClient) ById(id string) (*RestoreFromBackupInput, error) { + resp := &RestoreFromBackupInput{} + err := c.rancherClient.doById(RESTORE_FROM_BACKUP_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RestoreFromBackupInputClient) Delete(container *RestoreFromBackupInput) error { + return c.rancherClient.doResourceDelete(RESTORE_FROM_BACKUP_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_revert_to_snapshot_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_revert_to_snapshot_input.go new file mode 100644 index 0000000000..0612f8182d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_revert_to_snapshot_input.go @@ -0,0 +1,79 @@ +package client + +const ( + REVERT_TO_SNAPSHOT_INPUT_TYPE = "revertToSnapshotInput" +) + +type RevertToSnapshotInput struct { + Resource + + SnapshotId string `json:"snapshotId,omitempty" yaml:"snapshot_id,omitempty"` +} + +type RevertToSnapshotInputCollection struct { + Collection + Data []RevertToSnapshotInput `json:"data,omitempty"` + client *RevertToSnapshotInputClient +} + +type RevertToSnapshotInputClient struct { + rancherClient *RancherClient +} + +type RevertToSnapshotInputOperations interface { + List(opts *ListOpts) (*RevertToSnapshotInputCollection, error) + Create(opts *RevertToSnapshotInput) (*RevertToSnapshotInput, error) + Update(existing *RevertToSnapshotInput, updates interface{}) (*RevertToSnapshotInput, error) + ById(id string) (*RevertToSnapshotInput, error) + Delete(container *RevertToSnapshotInput) error +} + +func newRevertToSnapshotInputClient(rancherClient *RancherClient) *RevertToSnapshotInputClient { + return &RevertToSnapshotInputClient{ + rancherClient: rancherClient, + } +} + +func (c *RevertToSnapshotInputClient) Create(container *RevertToSnapshotInput) (*RevertToSnapshotInput, error) { + resp := &RevertToSnapshotInput{} + err := c.rancherClient.doCreate(REVERT_TO_SNAPSHOT_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *RevertToSnapshotInputClient) Update(existing *RevertToSnapshotInput, updates interface{}) (*RevertToSnapshotInput, error) { + resp := &RevertToSnapshotInput{} + err := c.rancherClient.doUpdate(REVERT_TO_SNAPSHOT_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RevertToSnapshotInputClient) List(opts *ListOpts) (*RevertToSnapshotInputCollection, error) { + resp := &RevertToSnapshotInputCollection{} + err := c.rancherClient.doList(REVERT_TO_SNAPSHOT_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RevertToSnapshotInputCollection) Next() (*RevertToSnapshotInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RevertToSnapshotInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RevertToSnapshotInputClient) ById(id string) (*RevertToSnapshotInput, error) { + resp := &RevertToSnapshotInput{} + err := c.rancherClient.doById(REVERT_TO_SNAPSHOT_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RevertToSnapshotInputClient) Delete(container *RevertToSnapshotInput) error { + return c.rancherClient.doResourceDelete(REVERT_TO_SNAPSHOT_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_rolling_restart_strategy.go b/vendor/github.com/rancher/go-rancher/v2/generated_rolling_restart_strategy.go new file mode 100644 index 0000000000..f2384cdec9 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_rolling_restart_strategy.go @@ -0,0 +1,81 @@ +package client + +const ( + ROLLING_RESTART_STRATEGY_TYPE = "rollingRestartStrategy" +) + +type RollingRestartStrategy struct { + Resource + + BatchSize int64 `json:"batchSize,omitempty" yaml:"batch_size,omitempty"` + + IntervalMillis int64 `json:"intervalMillis,omitempty" yaml:"interval_millis,omitempty"` +} + +type RollingRestartStrategyCollection struct { + Collection + Data []RollingRestartStrategy `json:"data,omitempty"` + client *RollingRestartStrategyClient +} + +type RollingRestartStrategyClient struct { + rancherClient *RancherClient +} + +type RollingRestartStrategyOperations interface { + List(opts *ListOpts) (*RollingRestartStrategyCollection, error) + Create(opts *RollingRestartStrategy) (*RollingRestartStrategy, error) + Update(existing *RollingRestartStrategy, updates interface{}) (*RollingRestartStrategy, error) + ById(id string) (*RollingRestartStrategy, error) + Delete(container *RollingRestartStrategy) error +} + +func newRollingRestartStrategyClient(rancherClient *RancherClient) *RollingRestartStrategyClient { + return &RollingRestartStrategyClient{ + rancherClient: rancherClient, + } +} + +func (c *RollingRestartStrategyClient) Create(container *RollingRestartStrategy) (*RollingRestartStrategy, error) { + resp := &RollingRestartStrategy{} + err := c.rancherClient.doCreate(ROLLING_RESTART_STRATEGY_TYPE, container, resp) + return resp, err +} + +func (c *RollingRestartStrategyClient) Update(existing *RollingRestartStrategy, updates interface{}) (*RollingRestartStrategy, error) { + resp := &RollingRestartStrategy{} + err := c.rancherClient.doUpdate(ROLLING_RESTART_STRATEGY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *RollingRestartStrategyClient) List(opts *ListOpts) (*RollingRestartStrategyCollection, error) { + resp := &RollingRestartStrategyCollection{} + err := c.rancherClient.doList(ROLLING_RESTART_STRATEGY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *RollingRestartStrategyCollection) Next() (*RollingRestartStrategyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &RollingRestartStrategyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *RollingRestartStrategyClient) ById(id string) (*RollingRestartStrategy, error) { + resp := &RollingRestartStrategy{} + err := c.rancherClient.doById(ROLLING_RESTART_STRATEGY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *RollingRestartStrategyClient) Delete(container *RollingRestartStrategy) error { + return c.rancherClient.doResourceDelete(ROLLING_RESTART_STRATEGY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_scale_policy.go b/vendor/github.com/rancher/go-rancher/v2/generated_scale_policy.go new file mode 100644 index 0000000000..eb0ac83a53 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_scale_policy.go @@ -0,0 +1,83 @@ +package client + +const ( + SCALE_POLICY_TYPE = "scalePolicy" +) + +type ScalePolicy struct { + Resource + + Increment int64 `json:"increment,omitempty" yaml:"increment,omitempty"` + + Max int64 `json:"max,omitempty" yaml:"max,omitempty"` + + Min int64 `json:"min,omitempty" yaml:"min,omitempty"` +} + +type ScalePolicyCollection struct { + Collection + Data []ScalePolicy `json:"data,omitempty"` + client *ScalePolicyClient +} + +type ScalePolicyClient struct { + rancherClient *RancherClient +} + +type ScalePolicyOperations interface { + List(opts *ListOpts) (*ScalePolicyCollection, error) + Create(opts *ScalePolicy) (*ScalePolicy, error) + Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) + ById(id string) (*ScalePolicy, error) + Delete(container *ScalePolicy) error +} + +func newScalePolicyClient(rancherClient *RancherClient) *ScalePolicyClient { + return &ScalePolicyClient{ + rancherClient: rancherClient, + } +} + +func (c *ScalePolicyClient) Create(container *ScalePolicy) (*ScalePolicy, error) { + resp := &ScalePolicy{} + err := c.rancherClient.doCreate(SCALE_POLICY_TYPE, container, resp) + return resp, err +} + +func (c *ScalePolicyClient) Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) { + resp := &ScalePolicy{} + err := c.rancherClient.doUpdate(SCALE_POLICY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ScalePolicyClient) List(opts *ListOpts) (*ScalePolicyCollection, error) { + resp := &ScalePolicyCollection{} + err := c.rancherClient.doList(SCALE_POLICY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ScalePolicyCollection) Next() (*ScalePolicyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ScalePolicyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ScalePolicyClient) ById(id string) (*ScalePolicy, error) { + resp := &ScalePolicy{} + err := c.rancherClient.doById(SCALE_POLICY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ScalePolicyClient) Delete(container *ScalePolicy) error { + return c.rancherClient.doResourceDelete(SCALE_POLICY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_scheduled_upgrade.go b/vendor/github.com/rancher/go-rancher/v2/generated_scheduled_upgrade.go new file mode 100644 index 0000000000..bfe0dfdd9c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_scheduled_upgrade.go @@ -0,0 +1,136 @@ +package client + +const ( + SCHEDULED_UPGRADE_TYPE = "scheduledUpgrade" +) + +type ScheduledUpgrade struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + Started string `json:"started,omitempty" yaml:"started,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ScheduledUpgradeCollection struct { + Collection + Data []ScheduledUpgrade `json:"data,omitempty"` + client *ScheduledUpgradeClient +} + +type ScheduledUpgradeClient struct { + rancherClient *RancherClient +} + +type ScheduledUpgradeOperations interface { + List(opts *ListOpts) (*ScheduledUpgradeCollection, error) + Create(opts *ScheduledUpgrade) (*ScheduledUpgrade, error) + Update(existing *ScheduledUpgrade, updates interface{}) (*ScheduledUpgrade, error) + ById(id string) (*ScheduledUpgrade, error) + Delete(container *ScheduledUpgrade) error + + ActionCreate(*ScheduledUpgrade) (*ScheduledUpgrade, error) + + ActionRemove(*ScheduledUpgrade) (*ScheduledUpgrade, error) + + ActionStart(*ScheduledUpgrade) (*ScheduledUpgrade, error) +} + +func newScheduledUpgradeClient(rancherClient *RancherClient) *ScheduledUpgradeClient { + return &ScheduledUpgradeClient{ + rancherClient: rancherClient, + } +} + +func (c *ScheduledUpgradeClient) Create(container *ScheduledUpgrade) (*ScheduledUpgrade, error) { + resp := &ScheduledUpgrade{} + err := c.rancherClient.doCreate(SCHEDULED_UPGRADE_TYPE, container, resp) + return resp, err +} + +func (c *ScheduledUpgradeClient) Update(existing *ScheduledUpgrade, updates interface{}) (*ScheduledUpgrade, error) { + resp := &ScheduledUpgrade{} + err := c.rancherClient.doUpdate(SCHEDULED_UPGRADE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ScheduledUpgradeClient) List(opts *ListOpts) (*ScheduledUpgradeCollection, error) { + resp := &ScheduledUpgradeCollection{} + err := c.rancherClient.doList(SCHEDULED_UPGRADE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ScheduledUpgradeCollection) Next() (*ScheduledUpgradeCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ScheduledUpgradeCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ScheduledUpgradeClient) ById(id string) (*ScheduledUpgrade, error) { + resp := &ScheduledUpgrade{} + err := c.rancherClient.doById(SCHEDULED_UPGRADE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ScheduledUpgradeClient) Delete(container *ScheduledUpgrade) error { + return c.rancherClient.doResourceDelete(SCHEDULED_UPGRADE_TYPE, &container.Resource) +} + +func (c *ScheduledUpgradeClient) ActionCreate(resource *ScheduledUpgrade) (*ScheduledUpgrade, error) { + + resp := &ScheduledUpgrade{} + + err := c.rancherClient.doAction(SCHEDULED_UPGRADE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ScheduledUpgradeClient) ActionRemove(resource *ScheduledUpgrade) (*ScheduledUpgrade, error) { + + resp := &ScheduledUpgrade{} + + err := c.rancherClient.doAction(SCHEDULED_UPGRADE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ScheduledUpgradeClient) ActionStart(resource *ScheduledUpgrade) (*ScheduledUpgrade, error) { + + resp := &ScheduledUpgrade{} + + err := c.rancherClient.doAction(SCHEDULED_UPGRADE_TYPE, "start", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_secondary_launch_config.go b/vendor/github.com/rancher/go-rancher/v2/generated_secondary_launch_config.go new file mode 100644 index 0000000000..b5653fa61b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_secondary_launch_config.go @@ -0,0 +1,520 @@ +package client + +const ( + SECONDARY_LAUNCH_CONFIG_TYPE = "secondaryLaunchConfig" +) + +type SecondaryLaunchConfig struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` + + AllocationState string `json:"allocationState,omitempty" yaml:"allocation_state,omitempty"` + + BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"` + + BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"` + + Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"` + + CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"` + + CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,omitempty"` + + CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"` + + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + + Count int64 `json:"count,omitempty" yaml:"count,omitempty"` + + CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"` + + CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"` + + CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"` + + CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"` + + CpuRealtimePeriod int64 `json:"cpuRealtimePeriod,omitempty" yaml:"cpu_realtime_period,omitempty"` + + CpuRealtimeRuntime int64 `json:"cpuRealtimeRuntime,omitempty" yaml:"cpu_realtime_runtime,omitempty"` + + CpuSet string `json:"cpuSet,omitempty" yaml:"cpu_set,omitempty"` + + CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"` + + CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DataVolumeMounts map[string]interface{} `json:"dataVolumeMounts,omitempty" yaml:"data_volume_mounts,omitempty"` + + DataVolumes []string `json:"dataVolumes,omitempty" yaml:"data_volumes,omitempty"` + + DataVolumesFrom []string `json:"dataVolumesFrom,omitempty" yaml:"data_volumes_from,omitempty"` + + DataVolumesFromLaunchConfigs []string `json:"dataVolumesFromLaunchConfigs,omitempty" yaml:"data_volumes_from_launch_configs,omitempty"` + + DeploymentUnitUuid string `json:"deploymentUnitUuid,omitempty" yaml:"deployment_unit_uuid,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Devices []string `json:"devices,omitempty" yaml:"devices,omitempty"` + + DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"` + + Disks []VirtualMachineDisk `json:"disks,omitempty" yaml:"disks,omitempty"` + + Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"` + + DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"` + + DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"` + + DrainTimeoutMs int64 `json:"drainTimeoutMs,omitempty" yaml:"drain_timeout_ms,omitempty"` + + EntryPoint []string `json:"entryPoint,omitempty" yaml:"entry_point,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + Expose []string `json:"expose,omitempty" yaml:"expose,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExtraHosts []string `json:"extraHosts,omitempty" yaml:"extra_hosts,omitempty"` + + FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"` + + GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"` + + HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"` + + HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"` + + HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"` + + HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + ImageUuid string `json:"imageUuid,omitempty" yaml:"image_uuid,omitempty"` + + InstanceLinks map[string]interface{} `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"` + + InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"` + + IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"` + + IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"` + + Ip string `json:"ip,omitempty" yaml:"ip,omitempty"` + + Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"` + + IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"` + + Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"` + + KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + LogConfig *LogConfig `json:"logConfig,omitempty" yaml:"log_config,omitempty"` + + LxcConf map[string]interface{} `json:"lxcConf,omitempty" yaml:"lxc_conf,omitempty"` + + Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"` + + MemoryMb int64 `json:"memoryMb,omitempty" yaml:"memory_mb,omitempty"` + + MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"` + + MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"` + + MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"` + + MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"` + + Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"` + + NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"` + + NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"` + + NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"` + + NetworkLaunchConfig string `json:"networkLaunchConfig,omitempty" yaml:"network_launch_config,omitempty"` + + NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"` + + OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"` + + OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"` + + PidMode string `json:"pidMode,omitempty" yaml:"pid_mode,omitempty"` + + PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + + PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"` + + PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"` + + Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"` + + PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,omitempty"` + + ReadOnly bool `json:"readOnly,omitempty" yaml:"read_only,omitempty"` + + RegistryCredentialId string `json:"registryCredentialId,omitempty" yaml:"registry_credential_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RequestedHostId string `json:"requestedHostId,omitempty" yaml:"requested_host_id,omitempty"` + + RequestedIpAddress string `json:"requestedIpAddress,omitempty" yaml:"requested_ip_address,omitempty"` + + RunInit bool `json:"runInit,omitempty" yaml:"run_init,omitempty"` + + Secrets []SecretReference `json:"secrets,omitempty" yaml:"secrets,omitempty"` + + SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StdinOpen bool `json:"stdinOpen,omitempty" yaml:"stdin_open,omitempty"` + + StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"` + + StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"` + + StorageOpt map[string]interface{} `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"` + + Sysctls map[string]interface{} `json:"sysctls,omitempty" yaml:"sysctls,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Tmpfs map[string]interface{} `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` + + Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` + + User string `json:"user,omitempty" yaml:"user,omitempty"` + + UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"` + + Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"` + + UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"` + + Uts string `json:"uts,omitempty" yaml:"uts,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vcpu int64 `json:"vcpu,omitempty" yaml:"vcpu,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` + + VolumeDriver string `json:"volumeDriver,omitempty" yaml:"volume_driver,omitempty"` + + WorkingDir string `json:"workingDir,omitempty" yaml:"working_dir,omitempty"` +} + +type SecondaryLaunchConfigCollection struct { + Collection + Data []SecondaryLaunchConfig `json:"data,omitempty"` + client *SecondaryLaunchConfigClient +} + +type SecondaryLaunchConfigClient struct { + rancherClient *RancherClient +} + +type SecondaryLaunchConfigOperations interface { + List(opts *ListOpts) (*SecondaryLaunchConfigCollection, error) + Create(opts *SecondaryLaunchConfig) (*SecondaryLaunchConfig, error) + Update(existing *SecondaryLaunchConfig, updates interface{}) (*SecondaryLaunchConfig, error) + ById(id string) (*SecondaryLaunchConfig, error) + Delete(container *SecondaryLaunchConfig) error + + ActionAllocate(*SecondaryLaunchConfig) (*Instance, error) + + ActionConsole(*SecondaryLaunchConfig, *InstanceConsoleInput) (*InstanceConsole, error) + + ActionCreate(*SecondaryLaunchConfig) (*Instance, error) + + ActionDeallocate(*SecondaryLaunchConfig) (*Instance, error) + + ActionError(*SecondaryLaunchConfig) (*Instance, error) + + ActionExecute(*SecondaryLaunchConfig, *ContainerExec) (*HostAccess, error) + + ActionMigrate(*SecondaryLaunchConfig) (*Instance, error) + + ActionProxy(*SecondaryLaunchConfig, *ContainerProxy) (*HostAccess, error) + + ActionPurge(*SecondaryLaunchConfig) (*Instance, error) + + ActionRemove(*SecondaryLaunchConfig) (*Instance, error) + + ActionRestart(*SecondaryLaunchConfig) (*Instance, error) + + ActionStart(*SecondaryLaunchConfig) (*Instance, error) + + ActionStop(*SecondaryLaunchConfig, *InstanceStop) (*Instance, error) + + ActionUpdate(*SecondaryLaunchConfig) (*Instance, error) + + ActionUpdatehealthy(*SecondaryLaunchConfig) (*Instance, error) + + ActionUpdatereinitializing(*SecondaryLaunchConfig) (*Instance, error) + + ActionUpdateunhealthy(*SecondaryLaunchConfig) (*Instance, error) +} + +func newSecondaryLaunchConfigClient(rancherClient *RancherClient) *SecondaryLaunchConfigClient { + return &SecondaryLaunchConfigClient{ + rancherClient: rancherClient, + } +} + +func (c *SecondaryLaunchConfigClient) Create(container *SecondaryLaunchConfig) (*SecondaryLaunchConfig, error) { + resp := &SecondaryLaunchConfig{} + err := c.rancherClient.doCreate(SECONDARY_LAUNCH_CONFIG_TYPE, container, resp) + return resp, err +} + +func (c *SecondaryLaunchConfigClient) Update(existing *SecondaryLaunchConfig, updates interface{}) (*SecondaryLaunchConfig, error) { + resp := &SecondaryLaunchConfig{} + err := c.rancherClient.doUpdate(SECONDARY_LAUNCH_CONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SecondaryLaunchConfigClient) List(opts *ListOpts) (*SecondaryLaunchConfigCollection, error) { + resp := &SecondaryLaunchConfigCollection{} + err := c.rancherClient.doList(SECONDARY_LAUNCH_CONFIG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SecondaryLaunchConfigCollection) Next() (*SecondaryLaunchConfigCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SecondaryLaunchConfigCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SecondaryLaunchConfigClient) ById(id string) (*SecondaryLaunchConfig, error) { + resp := &SecondaryLaunchConfig{} + err := c.rancherClient.doById(SECONDARY_LAUNCH_CONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SecondaryLaunchConfigClient) Delete(container *SecondaryLaunchConfig) error { + return c.rancherClient.doResourceDelete(SECONDARY_LAUNCH_CONFIG_TYPE, &container.Resource) +} + +func (c *SecondaryLaunchConfigClient) ActionAllocate(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "allocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionConsole(resource *SecondaryLaunchConfig, input *InstanceConsoleInput) (*InstanceConsole, error) { + + resp := &InstanceConsole{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "console", &resource.Resource, input, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionCreate(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionDeallocate(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "deallocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionError(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionExecute(resource *SecondaryLaunchConfig, input *ContainerExec) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "execute", &resource.Resource, input, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionMigrate(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "migrate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionProxy(resource *SecondaryLaunchConfig, input *ContainerProxy) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "proxy", &resource.Resource, input, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionPurge(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionRemove(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionRestart(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "restart", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionStart(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "start", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionStop(resource *SecondaryLaunchConfig, input *InstanceStop) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "stop", &resource.Resource, input, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionUpdate(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionUpdatehealthy(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "updatehealthy", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionUpdatereinitializing(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "updatereinitializing", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecondaryLaunchConfigClient) ActionUpdateunhealthy(resource *SecondaryLaunchConfig) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "updateunhealthy", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_secret.go b/vendor/github.com/rancher/go-rancher/v2/generated_secret.go new file mode 100644 index 0000000000..0ae5737d80 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_secret.go @@ -0,0 +1,127 @@ +package client + +const ( + SECRET_TYPE = "secret" +) + +type Secret struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type SecretCollection struct { + Collection + Data []Secret `json:"data,omitempty"` + client *SecretClient +} + +type SecretClient struct { + rancherClient *RancherClient +} + +type SecretOperations interface { + List(opts *ListOpts) (*SecretCollection, error) + Create(opts *Secret) (*Secret, error) + Update(existing *Secret, updates interface{}) (*Secret, error) + ById(id string) (*Secret, error) + Delete(container *Secret) error + + ActionCreate(*Secret) (*Secret, error) + + ActionRemove(*Secret) (*Secret, error) +} + +func newSecretClient(rancherClient *RancherClient) *SecretClient { + return &SecretClient{ + rancherClient: rancherClient, + } +} + +func (c *SecretClient) Create(container *Secret) (*Secret, error) { + resp := &Secret{} + err := c.rancherClient.doCreate(SECRET_TYPE, container, resp) + return resp, err +} + +func (c *SecretClient) Update(existing *Secret, updates interface{}) (*Secret, error) { + resp := &Secret{} + err := c.rancherClient.doUpdate(SECRET_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SecretClient) List(opts *ListOpts) (*SecretCollection, error) { + resp := &SecretCollection{} + err := c.rancherClient.doList(SECRET_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SecretCollection) Next() (*SecretCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SecretCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SecretClient) ById(id string) (*Secret, error) { + resp := &Secret{} + err := c.rancherClient.doById(SECRET_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SecretClient) Delete(container *Secret) error { + return c.rancherClient.doResourceDelete(SECRET_TYPE, &container.Resource) +} + +func (c *SecretClient) ActionCreate(resource *Secret) (*Secret, error) { + + resp := &Secret{} + + err := c.rancherClient.doAction(SECRET_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SecretClient) ActionRemove(resource *Secret) (*Secret, error) { + + resp := &Secret{} + + err := c.rancherClient.doAction(SECRET_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_secret_reference.go b/vendor/github.com/rancher/go-rancher/v2/generated_secret_reference.go new file mode 100644 index 0000000000..fb6915f2e1 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_secret_reference.go @@ -0,0 +1,87 @@ +package client + +const ( + SECRET_REFERENCE_TYPE = "secretReference" +) + +type SecretReference struct { + Resource + + Gid string `json:"gid,omitempty" yaml:"gid,omitempty"` + + Mode string `json:"mode,omitempty" yaml:"mode,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + SecretId string `json:"secretId,omitempty" yaml:"secret_id,omitempty"` + + Uid string `json:"uid,omitempty" yaml:"uid,omitempty"` +} + +type SecretReferenceCollection struct { + Collection + Data []SecretReference `json:"data,omitempty"` + client *SecretReferenceClient +} + +type SecretReferenceClient struct { + rancherClient *RancherClient +} + +type SecretReferenceOperations interface { + List(opts *ListOpts) (*SecretReferenceCollection, error) + Create(opts *SecretReference) (*SecretReference, error) + Update(existing *SecretReference, updates interface{}) (*SecretReference, error) + ById(id string) (*SecretReference, error) + Delete(container *SecretReference) error +} + +func newSecretReferenceClient(rancherClient *RancherClient) *SecretReferenceClient { + return &SecretReferenceClient{ + rancherClient: rancherClient, + } +} + +func (c *SecretReferenceClient) Create(container *SecretReference) (*SecretReference, error) { + resp := &SecretReference{} + err := c.rancherClient.doCreate(SECRET_REFERENCE_TYPE, container, resp) + return resp, err +} + +func (c *SecretReferenceClient) Update(existing *SecretReference, updates interface{}) (*SecretReference, error) { + resp := &SecretReference{} + err := c.rancherClient.doUpdate(SECRET_REFERENCE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SecretReferenceClient) List(opts *ListOpts) (*SecretReferenceCollection, error) { + resp := &SecretReferenceCollection{} + err := c.rancherClient.doList(SECRET_REFERENCE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SecretReferenceCollection) Next() (*SecretReferenceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SecretReferenceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SecretReferenceClient) ById(id string) (*SecretReference, error) { + resp := &SecretReference{} + err := c.rancherClient.doById(SECRET_REFERENCE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SecretReferenceClient) Delete(container *SecretReference) error { + return c.rancherClient.doResourceDelete(SECRET_REFERENCE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_service.go new file mode 100644 index 0000000000..4cfb48076c --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service.go @@ -0,0 +1,303 @@ +package client + +const ( + SERVICE_TYPE = "service" +) + +type Service struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AssignServiceIpAddress bool `json:"assignServiceIpAddress,omitempty" yaml:"assign_service_ip_address,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LbConfig *LbTargetConfig `json:"lbConfig,omitempty" yaml:"lb_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RetainIp bool `json:"retainIp,omitempty" yaml:"retain_ip,omitempty"` + + Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + + SecondaryLaunchConfigs []SecondaryLaunchConfig `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"` + + SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` + + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Upgrade *ServiceUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vip string `json:"vip,omitempty" yaml:"vip,omitempty"` +} + +type ServiceCollection struct { + Collection + Data []Service `json:"data,omitempty"` + client *ServiceClient +} + +type ServiceClient struct { + rancherClient *RancherClient +} + +type ServiceOperations interface { + List(opts *ListOpts) (*ServiceCollection, error) + Create(opts *Service) (*Service, error) + Update(existing *Service, updates interface{}) (*Service, error) + ById(id string) (*Service, error) + Delete(container *Service) error + + ActionActivate(*Service) (*Service, error) + + ActionAddservicelink(*Service, *AddRemoveServiceLinkInput) (*Service, error) + + ActionCancelupgrade(*Service) (*Service, error) + + ActionContinueupgrade(*Service) (*Service, error) + + ActionCreate(*Service) (*Service, error) + + ActionDeactivate(*Service) (*Service, error) + + ActionFinishupgrade(*Service) (*Service, error) + + ActionRemove(*Service) (*Service, error) + + ActionRemoveservicelink(*Service, *AddRemoveServiceLinkInput) (*Service, error) + + ActionRestart(*Service, *ServiceRestart) (*Service, error) + + ActionRollback(*Service) (*Service, error) + + ActionSetservicelinks(*Service, *SetServiceLinksInput) (*Service, error) + + ActionUpdate(*Service) (*Service, error) + + ActionUpgrade(*Service, *ServiceUpgrade) (*Service, error) +} + +func newServiceClient(rancherClient *RancherClient) *ServiceClient { + return &ServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceClient) Create(container *Service) (*Service, error) { + resp := &Service{} + err := c.rancherClient.doCreate(SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *ServiceClient) Update(existing *Service, updates interface{}) (*Service, error) { + resp := &Service{} + err := c.rancherClient.doUpdate(SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceClient) List(opts *ListOpts) (*ServiceCollection, error) { + resp := &ServiceCollection{} + err := c.rancherClient.doList(SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceCollection) Next() (*ServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceClient) ById(id string) (*Service, error) { + resp := &Service{} + err := c.rancherClient.doById(SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceClient) Delete(container *Service) error { + return c.rancherClient.doResourceDelete(SERVICE_TYPE, &container.Resource) +} + +func (c *ServiceClient) ActionActivate(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionAddservicelink(resource *Service, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ServiceClient) ActionCancelupgrade(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionContinueupgrade(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionCreate(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionDeactivate(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionFinishupgrade(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionRemove(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionRemoveservicelink(resource *Service, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ServiceClient) ActionRestart(resource *Service, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ServiceClient) ActionRollback(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionSetservicelinks(resource *Service, input *SetServiceLinksInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) + + return resp, err +} + +func (c *ServiceClient) ActionUpdate(resource *Service) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceClient) ActionUpgrade(resource *Service, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_binding.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_binding.go new file mode 100644 index 0000000000..3626917423 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_binding.go @@ -0,0 +1,81 @@ +package client + +const ( + SERVICE_BINDING_TYPE = "serviceBinding" +) + +type ServiceBinding struct { + Resource + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` +} + +type ServiceBindingCollection struct { + Collection + Data []ServiceBinding `json:"data,omitempty"` + client *ServiceBindingClient +} + +type ServiceBindingClient struct { + rancherClient *RancherClient +} + +type ServiceBindingOperations interface { + List(opts *ListOpts) (*ServiceBindingCollection, error) + Create(opts *ServiceBinding) (*ServiceBinding, error) + Update(existing *ServiceBinding, updates interface{}) (*ServiceBinding, error) + ById(id string) (*ServiceBinding, error) + Delete(container *ServiceBinding) error +} + +func newServiceBindingClient(rancherClient *RancherClient) *ServiceBindingClient { + return &ServiceBindingClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceBindingClient) Create(container *ServiceBinding) (*ServiceBinding, error) { + resp := &ServiceBinding{} + err := c.rancherClient.doCreate(SERVICE_BINDING_TYPE, container, resp) + return resp, err +} + +func (c *ServiceBindingClient) Update(existing *ServiceBinding, updates interface{}) (*ServiceBinding, error) { + resp := &ServiceBinding{} + err := c.rancherClient.doUpdate(SERVICE_BINDING_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceBindingClient) List(opts *ListOpts) (*ServiceBindingCollection, error) { + resp := &ServiceBindingCollection{} + err := c.rancherClient.doList(SERVICE_BINDING_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceBindingCollection) Next() (*ServiceBindingCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceBindingCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceBindingClient) ById(id string) (*ServiceBinding, error) { + resp := &ServiceBinding{} + err := c.rancherClient.doById(SERVICE_BINDING_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceBindingClient) Delete(container *ServiceBinding) error { + return c.rancherClient.doResourceDelete(SERVICE_BINDING_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_consume_map.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_consume_map.go new file mode 100644 index 0000000000..138afde3cf --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_consume_map.go @@ -0,0 +1,142 @@ +package client + +const ( + SERVICE_CONSUME_MAP_TYPE = "serviceConsumeMap" +) + +type ServiceConsumeMap struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + ConsumedServiceId string `json:"consumedServiceId,omitempty" yaml:"consumed_service_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ServiceConsumeMapCollection struct { + Collection + Data []ServiceConsumeMap `json:"data,omitempty"` + client *ServiceConsumeMapClient +} + +type ServiceConsumeMapClient struct { + rancherClient *RancherClient +} + +type ServiceConsumeMapOperations interface { + List(opts *ListOpts) (*ServiceConsumeMapCollection, error) + Create(opts *ServiceConsumeMap) (*ServiceConsumeMap, error) + Update(existing *ServiceConsumeMap, updates interface{}) (*ServiceConsumeMap, error) + ById(id string) (*ServiceConsumeMap, error) + Delete(container *ServiceConsumeMap) error + + ActionCreate(*ServiceConsumeMap) (*ServiceConsumeMap, error) + + ActionRemove(*ServiceConsumeMap) (*ServiceConsumeMap, error) + + ActionUpdate(*ServiceConsumeMap) (*ServiceConsumeMap, error) +} + +func newServiceConsumeMapClient(rancherClient *RancherClient) *ServiceConsumeMapClient { + return &ServiceConsumeMapClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceConsumeMapClient) Create(container *ServiceConsumeMap) (*ServiceConsumeMap, error) { + resp := &ServiceConsumeMap{} + err := c.rancherClient.doCreate(SERVICE_CONSUME_MAP_TYPE, container, resp) + return resp, err +} + +func (c *ServiceConsumeMapClient) Update(existing *ServiceConsumeMap, updates interface{}) (*ServiceConsumeMap, error) { + resp := &ServiceConsumeMap{} + err := c.rancherClient.doUpdate(SERVICE_CONSUME_MAP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceConsumeMapClient) List(opts *ListOpts) (*ServiceConsumeMapCollection, error) { + resp := &ServiceConsumeMapCollection{} + err := c.rancherClient.doList(SERVICE_CONSUME_MAP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceConsumeMapCollection) Next() (*ServiceConsumeMapCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceConsumeMapCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceConsumeMapClient) ById(id string) (*ServiceConsumeMap, error) { + resp := &ServiceConsumeMap{} + err := c.rancherClient.doById(SERVICE_CONSUME_MAP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceConsumeMapClient) Delete(container *ServiceConsumeMap) error { + return c.rancherClient.doResourceDelete(SERVICE_CONSUME_MAP_TYPE, &container.Resource) +} + +func (c *ServiceConsumeMapClient) ActionCreate(resource *ServiceConsumeMap) (*ServiceConsumeMap, error) { + + resp := &ServiceConsumeMap{} + + err := c.rancherClient.doAction(SERVICE_CONSUME_MAP_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceConsumeMapClient) ActionRemove(resource *ServiceConsumeMap) (*ServiceConsumeMap, error) { + + resp := &ServiceConsumeMap{} + + err := c.rancherClient.doAction(SERVICE_CONSUME_MAP_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceConsumeMapClient) ActionUpdate(resource *ServiceConsumeMap) (*ServiceConsumeMap, error) { + + resp := &ServiceConsumeMap{} + + err := c.rancherClient.doAction(SERVICE_CONSUME_MAP_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_event.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_event.go new file mode 100644 index 0000000000..71b3082f6a --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_event.go @@ -0,0 +1,135 @@ +package client + +const ( + SERVICE_EVENT_TYPE = "serviceEvent" +) + +type ServiceEvent struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalTimestamp int64 `json:"externalTimestamp,omitempty" yaml:"external_timestamp,omitempty"` + + HealthcheckUuid string `json:"healthcheckUuid,omitempty" yaml:"healthcheck_uuid,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ReportedHealth string `json:"reportedHealth,omitempty" yaml:"reported_health,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ServiceEventCollection struct { + Collection + Data []ServiceEvent `json:"data,omitempty"` + client *ServiceEventClient +} + +type ServiceEventClient struct { + rancherClient *RancherClient +} + +type ServiceEventOperations interface { + List(opts *ListOpts) (*ServiceEventCollection, error) + Create(opts *ServiceEvent) (*ServiceEvent, error) + Update(existing *ServiceEvent, updates interface{}) (*ServiceEvent, error) + ById(id string) (*ServiceEvent, error) + Delete(container *ServiceEvent) error + + ActionCreate(*ServiceEvent) (*ServiceEvent, error) + + ActionRemove(*ServiceEvent) (*ServiceEvent, error) +} + +func newServiceEventClient(rancherClient *RancherClient) *ServiceEventClient { + return &ServiceEventClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceEventClient) Create(container *ServiceEvent) (*ServiceEvent, error) { + resp := &ServiceEvent{} + err := c.rancherClient.doCreate(SERVICE_EVENT_TYPE, container, resp) + return resp, err +} + +func (c *ServiceEventClient) Update(existing *ServiceEvent, updates interface{}) (*ServiceEvent, error) { + resp := &ServiceEvent{} + err := c.rancherClient.doUpdate(SERVICE_EVENT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceEventClient) List(opts *ListOpts) (*ServiceEventCollection, error) { + resp := &ServiceEventCollection{} + err := c.rancherClient.doList(SERVICE_EVENT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceEventCollection) Next() (*ServiceEventCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceEventCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceEventClient) ById(id string) (*ServiceEvent, error) { + resp := &ServiceEvent{} + err := c.rancherClient.doById(SERVICE_EVENT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceEventClient) Delete(container *ServiceEvent) error { + return c.rancherClient.doResourceDelete(SERVICE_EVENT_TYPE, &container.Resource) +} + +func (c *ServiceEventClient) ActionCreate(resource *ServiceEvent) (*ServiceEvent, error) { + + resp := &ServiceEvent{} + + err := c.rancherClient.doAction(SERVICE_EVENT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceEventClient) ActionRemove(resource *ServiceEvent) (*ServiceEvent, error) { + + resp := &ServiceEvent{} + + err := c.rancherClient.doAction(SERVICE_EVENT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_expose_map.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_expose_map.go new file mode 100644 index 0000000000..06453bf488 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_expose_map.go @@ -0,0 +1,133 @@ +package client + +const ( + SERVICE_EXPOSE_MAP_TYPE = "serviceExposeMap" +) + +type ServiceExposeMap struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + IpAddress string `json:"ipAddress,omitempty" yaml:"ip_address,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Managed bool `json:"managed,omitempty" yaml:"managed,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ServiceExposeMapCollection struct { + Collection + Data []ServiceExposeMap `json:"data,omitempty"` + client *ServiceExposeMapClient +} + +type ServiceExposeMapClient struct { + rancherClient *RancherClient +} + +type ServiceExposeMapOperations interface { + List(opts *ListOpts) (*ServiceExposeMapCollection, error) + Create(opts *ServiceExposeMap) (*ServiceExposeMap, error) + Update(existing *ServiceExposeMap, updates interface{}) (*ServiceExposeMap, error) + ById(id string) (*ServiceExposeMap, error) + Delete(container *ServiceExposeMap) error + + ActionCreate(*ServiceExposeMap) (*ServiceExposeMap, error) + + ActionRemove(*ServiceExposeMap) (*ServiceExposeMap, error) +} + +func newServiceExposeMapClient(rancherClient *RancherClient) *ServiceExposeMapClient { + return &ServiceExposeMapClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceExposeMapClient) Create(container *ServiceExposeMap) (*ServiceExposeMap, error) { + resp := &ServiceExposeMap{} + err := c.rancherClient.doCreate(SERVICE_EXPOSE_MAP_TYPE, container, resp) + return resp, err +} + +func (c *ServiceExposeMapClient) Update(existing *ServiceExposeMap, updates interface{}) (*ServiceExposeMap, error) { + resp := &ServiceExposeMap{} + err := c.rancherClient.doUpdate(SERVICE_EXPOSE_MAP_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceExposeMapClient) List(opts *ListOpts) (*ServiceExposeMapCollection, error) { + resp := &ServiceExposeMapCollection{} + err := c.rancherClient.doList(SERVICE_EXPOSE_MAP_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceExposeMapCollection) Next() (*ServiceExposeMapCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceExposeMapCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceExposeMapClient) ById(id string) (*ServiceExposeMap, error) { + resp := &ServiceExposeMap{} + err := c.rancherClient.doById(SERVICE_EXPOSE_MAP_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceExposeMapClient) Delete(container *ServiceExposeMap) error { + return c.rancherClient.doResourceDelete(SERVICE_EXPOSE_MAP_TYPE, &container.Resource) +} + +func (c *ServiceExposeMapClient) ActionCreate(resource *ServiceExposeMap) (*ServiceExposeMap, error) { + + resp := &ServiceExposeMap{} + + err := c.rancherClient.doAction(SERVICE_EXPOSE_MAP_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *ServiceExposeMapClient) ActionRemove(resource *ServiceExposeMap) (*ServiceExposeMap, error) { + + resp := &ServiceExposeMap{} + + err := c.rancherClient.doAction(SERVICE_EXPOSE_MAP_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_link.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_link.go new file mode 100644 index 0000000000..350a4c80a6 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_link.go @@ -0,0 +1,85 @@ +package client + +const ( + SERVICE_LINK_TYPE = "serviceLink" +) + +type ServiceLink struct { + Resource `yaml:"-"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Service string `json:"service,omitempty" yaml:"service,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ServiceLinkCollection struct { + Collection + Data []ServiceLink `json:"data,omitempty"` + client *ServiceLinkClient +} + +type ServiceLinkClient struct { + rancherClient *RancherClient +} + +type ServiceLinkOperations interface { + List(opts *ListOpts) (*ServiceLinkCollection, error) + Create(opts *ServiceLink) (*ServiceLink, error) + Update(existing *ServiceLink, updates interface{}) (*ServiceLink, error) + ById(id string) (*ServiceLink, error) + Delete(container *ServiceLink) error +} + +func newServiceLinkClient(rancherClient *RancherClient) *ServiceLinkClient { + return &ServiceLinkClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceLinkClient) Create(container *ServiceLink) (*ServiceLink, error) { + resp := &ServiceLink{} + err := c.rancherClient.doCreate(SERVICE_LINK_TYPE, container, resp) + return resp, err +} + +func (c *ServiceLinkClient) Update(existing *ServiceLink, updates interface{}) (*ServiceLink, error) { + resp := &ServiceLink{} + err := c.rancherClient.doUpdate(SERVICE_LINK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceLinkClient) List(opts *ListOpts) (*ServiceLinkCollection, error) { + resp := &ServiceLinkCollection{} + err := c.rancherClient.doList(SERVICE_LINK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceLinkCollection) Next() (*ServiceLinkCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceLinkCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceLinkClient) ById(id string) (*ServiceLink, error) { + resp := &ServiceLink{} + err := c.rancherClient.doById(SERVICE_LINK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceLinkClient) Delete(container *ServiceLink) error { + return c.rancherClient.doResourceDelete(SERVICE_LINK_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_log.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_log.go new file mode 100644 index 0000000000..81c2236e77 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_log.go @@ -0,0 +1,101 @@ +package client + +const ( + SERVICE_LOG_TYPE = "serviceLog" +) + +type ServiceLog struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + EndTime string `json:"endTime,omitempty" yaml:"end_time,omitempty"` + + EventType string `json:"eventType,omitempty" yaml:"event_type,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Level string `json:"level,omitempty" yaml:"level,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + SubLog bool `json:"subLog,omitempty" yaml:"sub_log,omitempty"` + + TransactionId string `json:"transactionId,omitempty" yaml:"transaction_id,omitempty"` +} + +type ServiceLogCollection struct { + Collection + Data []ServiceLog `json:"data,omitempty"` + client *ServiceLogClient +} + +type ServiceLogClient struct { + rancherClient *RancherClient +} + +type ServiceLogOperations interface { + List(opts *ListOpts) (*ServiceLogCollection, error) + Create(opts *ServiceLog) (*ServiceLog, error) + Update(existing *ServiceLog, updates interface{}) (*ServiceLog, error) + ById(id string) (*ServiceLog, error) + Delete(container *ServiceLog) error +} + +func newServiceLogClient(rancherClient *RancherClient) *ServiceLogClient { + return &ServiceLogClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceLogClient) Create(container *ServiceLog) (*ServiceLog, error) { + resp := &ServiceLog{} + err := c.rancherClient.doCreate(SERVICE_LOG_TYPE, container, resp) + return resp, err +} + +func (c *ServiceLogClient) Update(existing *ServiceLog, updates interface{}) (*ServiceLog, error) { + resp := &ServiceLog{} + err := c.rancherClient.doUpdate(SERVICE_LOG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceLogClient) List(opts *ListOpts) (*ServiceLogCollection, error) { + resp := &ServiceLogCollection{} + err := c.rancherClient.doList(SERVICE_LOG_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceLogCollection) Next() (*ServiceLogCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceLogCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceLogClient) ById(id string) (*ServiceLog, error) { + resp := &ServiceLog{} + err := c.rancherClient.doById(SERVICE_LOG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceLogClient) Delete(container *ServiceLog) error { + return c.rancherClient.doResourceDelete(SERVICE_LOG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_proxy.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_proxy.go new file mode 100644 index 0000000000..2af160e9a3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_proxy.go @@ -0,0 +1,87 @@ +package client + +const ( + SERVICE_PROXY_TYPE = "serviceProxy" +) + +type ServiceProxy struct { + Resource + + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + + Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` + + Service string `json:"service,omitempty" yaml:"service,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Url string `json:"url,omitempty" yaml:"url,omitempty"` +} + +type ServiceProxyCollection struct { + Collection + Data []ServiceProxy `json:"data,omitempty"` + client *ServiceProxyClient +} + +type ServiceProxyClient struct { + rancherClient *RancherClient +} + +type ServiceProxyOperations interface { + List(opts *ListOpts) (*ServiceProxyCollection, error) + Create(opts *ServiceProxy) (*ServiceProxy, error) + Update(existing *ServiceProxy, updates interface{}) (*ServiceProxy, error) + ById(id string) (*ServiceProxy, error) + Delete(container *ServiceProxy) error +} + +func newServiceProxyClient(rancherClient *RancherClient) *ServiceProxyClient { + return &ServiceProxyClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceProxyClient) Create(container *ServiceProxy) (*ServiceProxy, error) { + resp := &ServiceProxy{} + err := c.rancherClient.doCreate(SERVICE_PROXY_TYPE, container, resp) + return resp, err +} + +func (c *ServiceProxyClient) Update(existing *ServiceProxy, updates interface{}) (*ServiceProxy, error) { + resp := &ServiceProxy{} + err := c.rancherClient.doUpdate(SERVICE_PROXY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceProxyClient) List(opts *ListOpts) (*ServiceProxyCollection, error) { + resp := &ServiceProxyCollection{} + err := c.rancherClient.doList(SERVICE_PROXY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceProxyCollection) Next() (*ServiceProxyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceProxyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceProxyClient) ById(id string) (*ServiceProxy, error) { + resp := &ServiceProxy{} + err := c.rancherClient.doById(SERVICE_PROXY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceProxyClient) Delete(container *ServiceProxy) error { + return c.rancherClient.doResourceDelete(SERVICE_PROXY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_restart.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_restart.go new file mode 100644 index 0000000000..5a470186a7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_restart.go @@ -0,0 +1,79 @@ +package client + +const ( + SERVICE_RESTART_TYPE = "serviceRestart" +) + +type ServiceRestart struct { + Resource + + RollingRestartStrategy RollingRestartStrategy `json:"rollingRestartStrategy,omitempty" yaml:"rolling_restart_strategy,omitempty"` +} + +type ServiceRestartCollection struct { + Collection + Data []ServiceRestart `json:"data,omitempty"` + client *ServiceRestartClient +} + +type ServiceRestartClient struct { + rancherClient *RancherClient +} + +type ServiceRestartOperations interface { + List(opts *ListOpts) (*ServiceRestartCollection, error) + Create(opts *ServiceRestart) (*ServiceRestart, error) + Update(existing *ServiceRestart, updates interface{}) (*ServiceRestart, error) + ById(id string) (*ServiceRestart, error) + Delete(container *ServiceRestart) error +} + +func newServiceRestartClient(rancherClient *RancherClient) *ServiceRestartClient { + return &ServiceRestartClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceRestartClient) Create(container *ServiceRestart) (*ServiceRestart, error) { + resp := &ServiceRestart{} + err := c.rancherClient.doCreate(SERVICE_RESTART_TYPE, container, resp) + return resp, err +} + +func (c *ServiceRestartClient) Update(existing *ServiceRestart, updates interface{}) (*ServiceRestart, error) { + resp := &ServiceRestart{} + err := c.rancherClient.doUpdate(SERVICE_RESTART_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceRestartClient) List(opts *ListOpts) (*ServiceRestartCollection, error) { + resp := &ServiceRestartCollection{} + err := c.rancherClient.doList(SERVICE_RESTART_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceRestartCollection) Next() (*ServiceRestartCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceRestartCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceRestartClient) ById(id string) (*ServiceRestart, error) { + resp := &ServiceRestart{} + err := c.rancherClient.doById(SERVICE_RESTART_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceRestartClient) Delete(container *ServiceRestart) error { + return c.rancherClient.doResourceDelete(SERVICE_RESTART_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade.go new file mode 100644 index 0000000000..1c97481684 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade.go @@ -0,0 +1,81 @@ +package client + +const ( + SERVICE_UPGRADE_TYPE = "serviceUpgrade" +) + +type ServiceUpgrade struct { + Resource + + InServiceStrategy *InServiceUpgradeStrategy `json:"inServiceStrategy,omitempty" yaml:"in_service_strategy,omitempty"` + + ToServiceStrategy *ToServiceUpgradeStrategy `json:"toServiceStrategy,omitempty" yaml:"to_service_strategy,omitempty"` +} + +type ServiceUpgradeCollection struct { + Collection + Data []ServiceUpgrade `json:"data,omitempty"` + client *ServiceUpgradeClient +} + +type ServiceUpgradeClient struct { + rancherClient *RancherClient +} + +type ServiceUpgradeOperations interface { + List(opts *ListOpts) (*ServiceUpgradeCollection, error) + Create(opts *ServiceUpgrade) (*ServiceUpgrade, error) + Update(existing *ServiceUpgrade, updates interface{}) (*ServiceUpgrade, error) + ById(id string) (*ServiceUpgrade, error) + Delete(container *ServiceUpgrade) error +} + +func newServiceUpgradeClient(rancherClient *RancherClient) *ServiceUpgradeClient { + return &ServiceUpgradeClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceUpgradeClient) Create(container *ServiceUpgrade) (*ServiceUpgrade, error) { + resp := &ServiceUpgrade{} + err := c.rancherClient.doCreate(SERVICE_UPGRADE_TYPE, container, resp) + return resp, err +} + +func (c *ServiceUpgradeClient) Update(existing *ServiceUpgrade, updates interface{}) (*ServiceUpgrade, error) { + resp := &ServiceUpgrade{} + err := c.rancherClient.doUpdate(SERVICE_UPGRADE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceUpgradeClient) List(opts *ListOpts) (*ServiceUpgradeCollection, error) { + resp := &ServiceUpgradeCollection{} + err := c.rancherClient.doList(SERVICE_UPGRADE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceUpgradeCollection) Next() (*ServiceUpgradeCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceUpgradeCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceUpgradeClient) ById(id string) (*ServiceUpgrade, error) { + resp := &ServiceUpgrade{} + err := c.rancherClient.doById(SERVICE_UPGRADE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceUpgradeClient) Delete(container *ServiceUpgrade) error { + return c.rancherClient.doResourceDelete(SERVICE_UPGRADE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade_strategy.go b/vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade_strategy.go new file mode 100644 index 0000000000..621403d390 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_service_upgrade_strategy.go @@ -0,0 +1,81 @@ +package client + +const ( + SERVICE_UPGRADE_STRATEGY_TYPE = "serviceUpgradeStrategy" +) + +type ServiceUpgradeStrategy struct { + Resource + + BatchSize int64 `json:"batchSize,omitempty" yaml:"batch_size,omitempty"` + + IntervalMillis int64 `json:"intervalMillis,omitempty" yaml:"interval_millis,omitempty"` +} + +type ServiceUpgradeStrategyCollection struct { + Collection + Data []ServiceUpgradeStrategy `json:"data,omitempty"` + client *ServiceUpgradeStrategyClient +} + +type ServiceUpgradeStrategyClient struct { + rancherClient *RancherClient +} + +type ServiceUpgradeStrategyOperations interface { + List(opts *ListOpts) (*ServiceUpgradeStrategyCollection, error) + Create(opts *ServiceUpgradeStrategy) (*ServiceUpgradeStrategy, error) + Update(existing *ServiceUpgradeStrategy, updates interface{}) (*ServiceUpgradeStrategy, error) + ById(id string) (*ServiceUpgradeStrategy, error) + Delete(container *ServiceUpgradeStrategy) error +} + +func newServiceUpgradeStrategyClient(rancherClient *RancherClient) *ServiceUpgradeStrategyClient { + return &ServiceUpgradeStrategyClient{ + rancherClient: rancherClient, + } +} + +func (c *ServiceUpgradeStrategyClient) Create(container *ServiceUpgradeStrategy) (*ServiceUpgradeStrategy, error) { + resp := &ServiceUpgradeStrategy{} + err := c.rancherClient.doCreate(SERVICE_UPGRADE_STRATEGY_TYPE, container, resp) + return resp, err +} + +func (c *ServiceUpgradeStrategyClient) Update(existing *ServiceUpgradeStrategy, updates interface{}) (*ServiceUpgradeStrategy, error) { + resp := &ServiceUpgradeStrategy{} + err := c.rancherClient.doUpdate(SERVICE_UPGRADE_STRATEGY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceUpgradeStrategyClient) List(opts *ListOpts) (*ServiceUpgradeStrategyCollection, error) { + resp := &ServiceUpgradeStrategyCollection{} + err := c.rancherClient.doList(SERVICE_UPGRADE_STRATEGY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceUpgradeStrategyCollection) Next() (*ServiceUpgradeStrategyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceUpgradeStrategyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceUpgradeStrategyClient) ById(id string) (*ServiceUpgradeStrategy, error) { + resp := &ServiceUpgradeStrategy{} + err := c.rancherClient.doById(SERVICE_UPGRADE_STRATEGY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServiceUpgradeStrategyClient) Delete(container *ServiceUpgradeStrategy) error { + return c.rancherClient.doResourceDelete(SERVICE_UPGRADE_STRATEGY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_services_port_range.go b/vendor/github.com/rancher/go-rancher/v2/generated_services_port_range.go new file mode 100644 index 0000000000..1d112c7a70 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_services_port_range.go @@ -0,0 +1,81 @@ +package client + +const ( + SERVICES_PORT_RANGE_TYPE = "servicesPortRange" +) + +type ServicesPortRange struct { + Resource + + EndPort int64 `json:"endPort,omitempty" yaml:"end_port,omitempty"` + + StartPort int64 `json:"startPort,omitempty" yaml:"start_port,omitempty"` +} + +type ServicesPortRangeCollection struct { + Collection + Data []ServicesPortRange `json:"data,omitempty"` + client *ServicesPortRangeClient +} + +type ServicesPortRangeClient struct { + rancherClient *RancherClient +} + +type ServicesPortRangeOperations interface { + List(opts *ListOpts) (*ServicesPortRangeCollection, error) + Create(opts *ServicesPortRange) (*ServicesPortRange, error) + Update(existing *ServicesPortRange, updates interface{}) (*ServicesPortRange, error) + ById(id string) (*ServicesPortRange, error) + Delete(container *ServicesPortRange) error +} + +func newServicesPortRangeClient(rancherClient *RancherClient) *ServicesPortRangeClient { + return &ServicesPortRangeClient{ + rancherClient: rancherClient, + } +} + +func (c *ServicesPortRangeClient) Create(container *ServicesPortRange) (*ServicesPortRange, error) { + resp := &ServicesPortRange{} + err := c.rancherClient.doCreate(SERVICES_PORT_RANGE_TYPE, container, resp) + return resp, err +} + +func (c *ServicesPortRangeClient) Update(existing *ServicesPortRange, updates interface{}) (*ServicesPortRange, error) { + resp := &ServicesPortRange{} + err := c.rancherClient.doUpdate(SERVICES_PORT_RANGE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServicesPortRangeClient) List(opts *ListOpts) (*ServicesPortRangeCollection, error) { + resp := &ServicesPortRangeCollection{} + err := c.rancherClient.doList(SERVICES_PORT_RANGE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServicesPortRangeCollection) Next() (*ServicesPortRangeCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServicesPortRangeCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServicesPortRangeClient) ById(id string) (*ServicesPortRange, error) { + resp := &ServicesPortRange{} + err := c.rancherClient.doById(SERVICES_PORT_RANGE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ServicesPortRangeClient) Delete(container *ServicesPortRange) error { + return c.rancherClient.doResourceDelete(SERVICES_PORT_RANGE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_set_project_members_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_set_project_members_input.go new file mode 100644 index 0000000000..6d09c9c3bf --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_set_project_members_input.go @@ -0,0 +1,79 @@ +package client + +const ( + SET_PROJECT_MEMBERS_INPUT_TYPE = "setProjectMembersInput" +) + +type SetProjectMembersInput struct { + Resource + + Members []ProjectMember `json:"members,omitempty" yaml:"members,omitempty"` +} + +type SetProjectMembersInputCollection struct { + Collection + Data []SetProjectMembersInput `json:"data,omitempty"` + client *SetProjectMembersInputClient +} + +type SetProjectMembersInputClient struct { + rancherClient *RancherClient +} + +type SetProjectMembersInputOperations interface { + List(opts *ListOpts) (*SetProjectMembersInputCollection, error) + Create(opts *SetProjectMembersInput) (*SetProjectMembersInput, error) + Update(existing *SetProjectMembersInput, updates interface{}) (*SetProjectMembersInput, error) + ById(id string) (*SetProjectMembersInput, error) + Delete(container *SetProjectMembersInput) error +} + +func newSetProjectMembersInputClient(rancherClient *RancherClient) *SetProjectMembersInputClient { + return &SetProjectMembersInputClient{ + rancherClient: rancherClient, + } +} + +func (c *SetProjectMembersInputClient) Create(container *SetProjectMembersInput) (*SetProjectMembersInput, error) { + resp := &SetProjectMembersInput{} + err := c.rancherClient.doCreate(SET_PROJECT_MEMBERS_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *SetProjectMembersInputClient) Update(existing *SetProjectMembersInput, updates interface{}) (*SetProjectMembersInput, error) { + resp := &SetProjectMembersInput{} + err := c.rancherClient.doUpdate(SET_PROJECT_MEMBERS_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SetProjectMembersInputClient) List(opts *ListOpts) (*SetProjectMembersInputCollection, error) { + resp := &SetProjectMembersInputCollection{} + err := c.rancherClient.doList(SET_PROJECT_MEMBERS_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SetProjectMembersInputCollection) Next() (*SetProjectMembersInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SetProjectMembersInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SetProjectMembersInputClient) ById(id string) (*SetProjectMembersInput, error) { + resp := &SetProjectMembersInput{} + err := c.rancherClient.doById(SET_PROJECT_MEMBERS_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SetProjectMembersInputClient) Delete(container *SetProjectMembersInput) error { + return c.rancherClient.doResourceDelete(SET_PROJECT_MEMBERS_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_set_service_links_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_set_service_links_input.go new file mode 100644 index 0000000000..a67d8c4de7 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_set_service_links_input.go @@ -0,0 +1,79 @@ +package client + +const ( + SET_SERVICE_LINKS_INPUT_TYPE = "setServiceLinksInput" +) + +type SetServiceLinksInput struct { + Resource + + ServiceLinks []ServiceLink `json:"serviceLinks,omitempty" yaml:"service_links,omitempty"` +} + +type SetServiceLinksInputCollection struct { + Collection + Data []SetServiceLinksInput `json:"data,omitempty"` + client *SetServiceLinksInputClient +} + +type SetServiceLinksInputClient struct { + rancherClient *RancherClient +} + +type SetServiceLinksInputOperations interface { + List(opts *ListOpts) (*SetServiceLinksInputCollection, error) + Create(opts *SetServiceLinksInput) (*SetServiceLinksInput, error) + Update(existing *SetServiceLinksInput, updates interface{}) (*SetServiceLinksInput, error) + ById(id string) (*SetServiceLinksInput, error) + Delete(container *SetServiceLinksInput) error +} + +func newSetServiceLinksInputClient(rancherClient *RancherClient) *SetServiceLinksInputClient { + return &SetServiceLinksInputClient{ + rancherClient: rancherClient, + } +} + +func (c *SetServiceLinksInputClient) Create(container *SetServiceLinksInput) (*SetServiceLinksInput, error) { + resp := &SetServiceLinksInput{} + err := c.rancherClient.doCreate(SET_SERVICE_LINKS_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *SetServiceLinksInputClient) Update(existing *SetServiceLinksInput, updates interface{}) (*SetServiceLinksInput, error) { + resp := &SetServiceLinksInput{} + err := c.rancherClient.doUpdate(SET_SERVICE_LINKS_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SetServiceLinksInputClient) List(opts *ListOpts) (*SetServiceLinksInputCollection, error) { + resp := &SetServiceLinksInputCollection{} + err := c.rancherClient.doList(SET_SERVICE_LINKS_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SetServiceLinksInputCollection) Next() (*SetServiceLinksInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SetServiceLinksInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SetServiceLinksInputClient) ById(id string) (*SetServiceLinksInput, error) { + resp := &SetServiceLinksInput{} + err := c.rancherClient.doById(SET_SERVICE_LINKS_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SetServiceLinksInputClient) Delete(container *SetServiceLinksInput) error { + return c.rancherClient.doResourceDelete(SET_SERVICE_LINKS_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_setting.go b/vendor/github.com/rancher/go-rancher/v2/generated_setting.go new file mode 100644 index 0000000000..02dd2df9c9 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_setting.go @@ -0,0 +1,87 @@ +package client + +const ( + SETTING_TYPE = "setting" +) + +type Setting struct { + Resource + + ActiveValue string `json:"activeValue,omitempty" yaml:"active_value,omitempty"` + + InDb bool `json:"inDb,omitempty" yaml:"in_db,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Source string `json:"source,omitempty" yaml:"source,omitempty"` + + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type SettingCollection struct { + Collection + Data []Setting `json:"data,omitempty"` + client *SettingClient +} + +type SettingClient struct { + rancherClient *RancherClient +} + +type SettingOperations interface { + List(opts *ListOpts) (*SettingCollection, error) + Create(opts *Setting) (*Setting, error) + Update(existing *Setting, updates interface{}) (*Setting, error) + ById(id string) (*Setting, error) + Delete(container *Setting) error +} + +func newSettingClient(rancherClient *RancherClient) *SettingClient { + return &SettingClient{ + rancherClient: rancherClient, + } +} + +func (c *SettingClient) Create(container *Setting) (*Setting, error) { + resp := &Setting{} + err := c.rancherClient.doCreate(SETTING_TYPE, container, resp) + return resp, err +} + +func (c *SettingClient) Update(existing *Setting, updates interface{}) (*Setting, error) { + resp := &Setting{} + err := c.rancherClient.doUpdate(SETTING_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SettingClient) List(opts *ListOpts) (*SettingCollection, error) { + resp := &SettingCollection{} + err := c.rancherClient.doList(SETTING_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SettingCollection) Next() (*SettingCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SettingCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SettingClient) ById(id string) (*Setting, error) { + resp := &Setting{} + err := c.rancherClient.doById(SETTING_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SettingClient) Delete(container *Setting) error { + return c.rancherClient.doResourceDelete(SETTING_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_snapshot.go b/vendor/github.com/rancher/go-rancher/v2/generated_snapshot.go new file mode 100644 index 0000000000..1c4ea033a1 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_snapshot.go @@ -0,0 +1,138 @@ +package client + +const ( + SNAPSHOT_TYPE = "snapshot" +) + +type Snapshot struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeId string `json:"volumeId,omitempty" yaml:"volume_id,omitempty"` +} + +type SnapshotCollection struct { + Collection + Data []Snapshot `json:"data,omitempty"` + client *SnapshotClient +} + +type SnapshotClient struct { + rancherClient *RancherClient +} + +type SnapshotOperations interface { + List(opts *ListOpts) (*SnapshotCollection, error) + Create(opts *Snapshot) (*Snapshot, error) + Update(existing *Snapshot, updates interface{}) (*Snapshot, error) + ById(id string) (*Snapshot, error) + Delete(container *Snapshot) error + + ActionBackup(*Snapshot, *SnapshotBackupInput) (*Backup, error) + + ActionCreate(*Snapshot) (*Snapshot, error) + + ActionRemove(*Snapshot) (*Snapshot, error) +} + +func newSnapshotClient(rancherClient *RancherClient) *SnapshotClient { + return &SnapshotClient{ + rancherClient: rancherClient, + } +} + +func (c *SnapshotClient) Create(container *Snapshot) (*Snapshot, error) { + resp := &Snapshot{} + err := c.rancherClient.doCreate(SNAPSHOT_TYPE, container, resp) + return resp, err +} + +func (c *SnapshotClient) Update(existing *Snapshot, updates interface{}) (*Snapshot, error) { + resp := &Snapshot{} + err := c.rancherClient.doUpdate(SNAPSHOT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SnapshotClient) List(opts *ListOpts) (*SnapshotCollection, error) { + resp := &SnapshotCollection{} + err := c.rancherClient.doList(SNAPSHOT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SnapshotCollection) Next() (*SnapshotCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SnapshotCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SnapshotClient) ById(id string) (*Snapshot, error) { + resp := &Snapshot{} + err := c.rancherClient.doById(SNAPSHOT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SnapshotClient) Delete(container *Snapshot) error { + return c.rancherClient.doResourceDelete(SNAPSHOT_TYPE, &container.Resource) +} + +func (c *SnapshotClient) ActionBackup(resource *Snapshot, input *SnapshotBackupInput) (*Backup, error) { + + resp := &Backup{} + + err := c.rancherClient.doAction(SNAPSHOT_TYPE, "backup", &resource.Resource, input, resp) + + return resp, err +} + +func (c *SnapshotClient) ActionCreate(resource *Snapshot) (*Snapshot, error) { + + resp := &Snapshot{} + + err := c.rancherClient.doAction(SNAPSHOT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SnapshotClient) ActionRemove(resource *Snapshot) (*Snapshot, error) { + + resp := &Snapshot{} + + err := c.rancherClient.doAction(SNAPSHOT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_snapshot_backup_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_snapshot_backup_input.go new file mode 100644 index 0000000000..9577ee6f58 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_snapshot_backup_input.go @@ -0,0 +1,107 @@ +package client + +const ( + SNAPSHOT_BACKUP_INPUT_TYPE = "snapshotBackupInput" +) + +type SnapshotBackupInput struct { + Resource + + BackupTargetId string `json:"backupTargetId,omitempty" yaml:"backup_target_id,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` +} + +type SnapshotBackupInputCollection struct { + Collection + Data []SnapshotBackupInput `json:"data,omitempty"` + client *SnapshotBackupInputClient +} + +type SnapshotBackupInputClient struct { + rancherClient *RancherClient +} + +type SnapshotBackupInputOperations interface { + List(opts *ListOpts) (*SnapshotBackupInputCollection, error) + Create(opts *SnapshotBackupInput) (*SnapshotBackupInput, error) + Update(existing *SnapshotBackupInput, updates interface{}) (*SnapshotBackupInput, error) + ById(id string) (*SnapshotBackupInput, error) + Delete(container *SnapshotBackupInput) error + + ActionCreate(*SnapshotBackupInput) (*Backup, error) + + ActionRemove(*SnapshotBackupInput) (*Backup, error) +} + +func newSnapshotBackupInputClient(rancherClient *RancherClient) *SnapshotBackupInputClient { + return &SnapshotBackupInputClient{ + rancherClient: rancherClient, + } +} + +func (c *SnapshotBackupInputClient) Create(container *SnapshotBackupInput) (*SnapshotBackupInput, error) { + resp := &SnapshotBackupInput{} + err := c.rancherClient.doCreate(SNAPSHOT_BACKUP_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *SnapshotBackupInputClient) Update(existing *SnapshotBackupInput, updates interface{}) (*SnapshotBackupInput, error) { + resp := &SnapshotBackupInput{} + err := c.rancherClient.doUpdate(SNAPSHOT_BACKUP_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SnapshotBackupInputClient) List(opts *ListOpts) (*SnapshotBackupInputCollection, error) { + resp := &SnapshotBackupInputCollection{} + err := c.rancherClient.doList(SNAPSHOT_BACKUP_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SnapshotBackupInputCollection) Next() (*SnapshotBackupInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SnapshotBackupInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SnapshotBackupInputClient) ById(id string) (*SnapshotBackupInput, error) { + resp := &SnapshotBackupInput{} + err := c.rancherClient.doById(SNAPSHOT_BACKUP_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SnapshotBackupInputClient) Delete(container *SnapshotBackupInput) error { + return c.rancherClient.doResourceDelete(SNAPSHOT_BACKUP_INPUT_TYPE, &container.Resource) +} + +func (c *SnapshotBackupInputClient) ActionCreate(resource *SnapshotBackupInput) (*Backup, error) { + + resp := &Backup{} + + err := c.rancherClient.doAction(SNAPSHOT_BACKUP_INPUT_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SnapshotBackupInputClient) ActionRemove(resource *SnapshotBackupInput) (*Backup, error) { + + resp := &Backup{} + + err := c.rancherClient.doAction(SNAPSHOT_BACKUP_INPUT_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_stack.go b/vendor/github.com/rancher/go-rancher/v2/generated_stack.go new file mode 100644 index 0000000000..f661218b95 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_stack.go @@ -0,0 +1,265 @@ +package client + +const ( + STACK_TYPE = "stack" +) + +type Stack struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"` + + Binding *Binding `json:"binding,omitempty" yaml:"binding,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DockerCompose string `json:"dockerCompose,omitempty" yaml:"docker_compose,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Group string `json:"group,omitempty" yaml:"group,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"` + + PreviousEnvironment map[string]interface{} `json:"previousEnvironment,omitempty" yaml:"previous_environment,omitempty"` + + PreviousExternalId string `json:"previousExternalId,omitempty" yaml:"previous_external_id,omitempty"` + + RancherCompose string `json:"rancherCompose,omitempty" yaml:"rancher_compose,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type StackCollection struct { + Collection + Data []Stack `json:"data,omitempty"` + client *StackClient +} + +type StackClient struct { + rancherClient *RancherClient +} + +type StackOperations interface { + List(opts *ListOpts) (*StackCollection, error) + Create(opts *Stack) (*Stack, error) + Update(existing *Stack, updates interface{}) (*Stack, error) + ById(id string) (*Stack, error) + Delete(container *Stack) error + + ActionActivateservices(*Stack) (*Stack, error) + + ActionAddoutputs(*Stack, *AddOutputsInput) (*Stack, error) + + ActionCancelupgrade(*Stack) (*Stack, error) + + ActionCreate(*Stack) (*Stack, error) + + ActionDeactivateservices(*Stack) (*Stack, error) + + ActionError(*Stack) (*Stack, error) + + ActionExportconfig(*Stack, *ComposeConfigInput) (*ComposeConfig, error) + + ActionFinishupgrade(*Stack) (*Stack, error) + + ActionRemove(*Stack) (*Stack, error) + + ActionRollback(*Stack) (*Stack, error) + + ActionUpdate(*Stack) (*Stack, error) + + ActionUpgrade(*Stack, *StackUpgrade) (*Stack, error) +} + +func newStackClient(rancherClient *RancherClient) *StackClient { + return &StackClient{ + rancherClient: rancherClient, + } +} + +func (c *StackClient) Create(container *Stack) (*Stack, error) { + resp := &Stack{} + err := c.rancherClient.doCreate(STACK_TYPE, container, resp) + return resp, err +} + +func (c *StackClient) Update(existing *Stack, updates interface{}) (*Stack, error) { + resp := &Stack{} + err := c.rancherClient.doUpdate(STACK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StackClient) List(opts *ListOpts) (*StackCollection, error) { + resp := &StackCollection{} + err := c.rancherClient.doList(STACK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StackCollection) Next() (*StackCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StackCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StackClient) ById(id string) (*Stack, error) { + resp := &Stack{} + err := c.rancherClient.doById(STACK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StackClient) Delete(container *Stack) error { + return c.rancherClient.doResourceDelete(STACK_TYPE, &container.Resource) +} + +func (c *StackClient) ActionActivateservices(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "activateservices", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionAddoutputs(resource *Stack, input *AddOutputsInput) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "addoutputs", &resource.Resource, input, resp) + + return resp, err +} + +func (c *StackClient) ActionCancelupgrade(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionCreate(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionDeactivateservices(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "deactivateservices", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionError(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionExportconfig(resource *Stack, input *ComposeConfigInput) (*ComposeConfig, error) { + + resp := &ComposeConfig{} + + err := c.rancherClient.doAction(STACK_TYPE, "exportconfig", &resource.Resource, input, resp) + + return resp, err +} + +func (c *StackClient) ActionFinishupgrade(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionRemove(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionRollback(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionUpdate(resource *Stack) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StackClient) ActionUpgrade(resource *Stack, input *StackUpgrade) (*Stack, error) { + + resp := &Stack{} + + err := c.rancherClient.doAction(STACK_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_stack_upgrade.go b/vendor/github.com/rancher/go-rancher/v2/generated_stack_upgrade.go new file mode 100644 index 0000000000..f4f78185f1 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_stack_upgrade.go @@ -0,0 +1,89 @@ +package client + +const ( + STACK_UPGRADE_TYPE = "stackUpgrade" +) + +type StackUpgrade struct { + Resource + + Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"` + + DockerCompose string `json:"dockerCompose,omitempty" yaml:"docker_compose,omitempty"` + + Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + RancherCompose string `json:"rancherCompose,omitempty" yaml:"rancher_compose,omitempty"` + + Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"` +} + +type StackUpgradeCollection struct { + Collection + Data []StackUpgrade `json:"data,omitempty"` + client *StackUpgradeClient +} + +type StackUpgradeClient struct { + rancherClient *RancherClient +} + +type StackUpgradeOperations interface { + List(opts *ListOpts) (*StackUpgradeCollection, error) + Create(opts *StackUpgrade) (*StackUpgrade, error) + Update(existing *StackUpgrade, updates interface{}) (*StackUpgrade, error) + ById(id string) (*StackUpgrade, error) + Delete(container *StackUpgrade) error +} + +func newStackUpgradeClient(rancherClient *RancherClient) *StackUpgradeClient { + return &StackUpgradeClient{ + rancherClient: rancherClient, + } +} + +func (c *StackUpgradeClient) Create(container *StackUpgrade) (*StackUpgrade, error) { + resp := &StackUpgrade{} + err := c.rancherClient.doCreate(STACK_UPGRADE_TYPE, container, resp) + return resp, err +} + +func (c *StackUpgradeClient) Update(existing *StackUpgrade, updates interface{}) (*StackUpgrade, error) { + resp := &StackUpgrade{} + err := c.rancherClient.doUpdate(STACK_UPGRADE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StackUpgradeClient) List(opts *ListOpts) (*StackUpgradeCollection, error) { + resp := &StackUpgradeCollection{} + err := c.rancherClient.doList(STACK_UPGRADE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StackUpgradeCollection) Next() (*StackUpgradeCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StackUpgradeCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StackUpgradeClient) ById(id string) (*StackUpgrade, error) { + resp := &StackUpgrade{} + err := c.rancherClient.doById(STACK_UPGRADE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StackUpgradeClient) Delete(container *StackUpgrade) error { + return c.rancherClient.doResourceDelete(STACK_UPGRADE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_state_transition.go b/vendor/github.com/rancher/go-rancher/v2/generated_state_transition.go new file mode 100644 index 0000000000..4fb565537b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_state_transition.go @@ -0,0 +1,77 @@ +package client + +const ( + STATE_TRANSITION_TYPE = "stateTransition" +) + +type StateTransition struct { + Resource +} + +type StateTransitionCollection struct { + Collection + Data []StateTransition `json:"data,omitempty"` + client *StateTransitionClient +} + +type StateTransitionClient struct { + rancherClient *RancherClient +} + +type StateTransitionOperations interface { + List(opts *ListOpts) (*StateTransitionCollection, error) + Create(opts *StateTransition) (*StateTransition, error) + Update(existing *StateTransition, updates interface{}) (*StateTransition, error) + ById(id string) (*StateTransition, error) + Delete(container *StateTransition) error +} + +func newStateTransitionClient(rancherClient *RancherClient) *StateTransitionClient { + return &StateTransitionClient{ + rancherClient: rancherClient, + } +} + +func (c *StateTransitionClient) Create(container *StateTransition) (*StateTransition, error) { + resp := &StateTransition{} + err := c.rancherClient.doCreate(STATE_TRANSITION_TYPE, container, resp) + return resp, err +} + +func (c *StateTransitionClient) Update(existing *StateTransition, updates interface{}) (*StateTransition, error) { + resp := &StateTransition{} + err := c.rancherClient.doUpdate(STATE_TRANSITION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StateTransitionClient) List(opts *ListOpts) (*StateTransitionCollection, error) { + resp := &StateTransitionCollection{} + err := c.rancherClient.doList(STATE_TRANSITION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StateTransitionCollection) Next() (*StateTransitionCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StateTransitionCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StateTransitionClient) ById(id string) (*StateTransition, error) { + resp := &StateTransition{} + err := c.rancherClient.doById(STATE_TRANSITION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StateTransitionClient) Delete(container *StateTransition) error { + return c.rancherClient.doResourceDelete(STATE_TRANSITION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_stats_access.go b/vendor/github.com/rancher/go-rancher/v2/generated_stats_access.go new file mode 100644 index 0000000000..1b7d814f34 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_stats_access.go @@ -0,0 +1,81 @@ +package client + +const ( + STATS_ACCESS_TYPE = "statsAccess" +) + +type StatsAccess struct { + Resource + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Url string `json:"url,omitempty" yaml:"url,omitempty"` +} + +type StatsAccessCollection struct { + Collection + Data []StatsAccess `json:"data,omitempty"` + client *StatsAccessClient +} + +type StatsAccessClient struct { + rancherClient *RancherClient +} + +type StatsAccessOperations interface { + List(opts *ListOpts) (*StatsAccessCollection, error) + Create(opts *StatsAccess) (*StatsAccess, error) + Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) + ById(id string) (*StatsAccess, error) + Delete(container *StatsAccess) error +} + +func newStatsAccessClient(rancherClient *RancherClient) *StatsAccessClient { + return &StatsAccessClient{ + rancherClient: rancherClient, + } +} + +func (c *StatsAccessClient) Create(container *StatsAccess) (*StatsAccess, error) { + resp := &StatsAccess{} + err := c.rancherClient.doCreate(STATS_ACCESS_TYPE, container, resp) + return resp, err +} + +func (c *StatsAccessClient) Update(existing *StatsAccess, updates interface{}) (*StatsAccess, error) { + resp := &StatsAccess{} + err := c.rancherClient.doUpdate(STATS_ACCESS_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StatsAccessClient) List(opts *ListOpts) (*StatsAccessCollection, error) { + resp := &StatsAccessCollection{} + err := c.rancherClient.doList(STATS_ACCESS_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StatsAccessCollection) Next() (*StatsAccessCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StatsAccessCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StatsAccessClient) ById(id string) (*StatsAccess, error) { + resp := &StatsAccess{} + err := c.rancherClient.doById(STATS_ACCESS_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StatsAccessClient) Delete(container *StatsAccess) error { + return c.rancherClient.doResourceDelete(STATS_ACCESS_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_storage_driver.go b/vendor/github.com/rancher/go-rancher/v2/generated_storage_driver.go new file mode 100644 index 0000000000..bf54aa4f3e --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_storage_driver.go @@ -0,0 +1,168 @@ +package client + +const ( + STORAGE_DRIVER_TYPE = "storageDriver" +) + +type StorageDriver struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + BlockDevicePath string `json:"blockDevicePath,omitempty" yaml:"block_device_path,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + Scope string `json:"scope,omitempty" yaml:"scope,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeAccessMode string `json:"volumeAccessMode,omitempty" yaml:"volume_access_mode,omitempty"` + + VolumeCapabilities []string `json:"volumeCapabilities,omitempty" yaml:"volume_capabilities,omitempty"` +} + +type StorageDriverCollection struct { + Collection + Data []StorageDriver `json:"data,omitempty"` + client *StorageDriverClient +} + +type StorageDriverClient struct { + rancherClient *RancherClient +} + +type StorageDriverOperations interface { + List(opts *ListOpts) (*StorageDriverCollection, error) + Create(opts *StorageDriver) (*StorageDriver, error) + Update(existing *StorageDriver, updates interface{}) (*StorageDriver, error) + ById(id string) (*StorageDriver, error) + Delete(container *StorageDriver) error + + ActionActivate(*StorageDriver) (*StorageDriver, error) + + ActionCreate(*StorageDriver) (*StorageDriver, error) + + ActionDeactivate(*StorageDriver) (*StorageDriver, error) + + ActionRemove(*StorageDriver) (*StorageDriver, error) + + ActionUpdate(*StorageDriver) (*StorageDriver, error) +} + +func newStorageDriverClient(rancherClient *RancherClient) *StorageDriverClient { + return &StorageDriverClient{ + rancherClient: rancherClient, + } +} + +func (c *StorageDriverClient) Create(container *StorageDriver) (*StorageDriver, error) { + resp := &StorageDriver{} + err := c.rancherClient.doCreate(STORAGE_DRIVER_TYPE, container, resp) + return resp, err +} + +func (c *StorageDriverClient) Update(existing *StorageDriver, updates interface{}) (*StorageDriver, error) { + resp := &StorageDriver{} + err := c.rancherClient.doUpdate(STORAGE_DRIVER_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StorageDriverClient) List(opts *ListOpts) (*StorageDriverCollection, error) { + resp := &StorageDriverCollection{} + err := c.rancherClient.doList(STORAGE_DRIVER_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StorageDriverCollection) Next() (*StorageDriverCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StorageDriverCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StorageDriverClient) ById(id string) (*StorageDriver, error) { + resp := &StorageDriver{} + err := c.rancherClient.doById(STORAGE_DRIVER_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StorageDriverClient) Delete(container *StorageDriver) error { + return c.rancherClient.doResourceDelete(STORAGE_DRIVER_TYPE, &container.Resource) +} + +func (c *StorageDriverClient) ActionActivate(resource *StorageDriver) (*StorageDriver, error) { + + resp := &StorageDriver{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverClient) ActionCreate(resource *StorageDriver) (*StorageDriver, error) { + + resp := &StorageDriver{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverClient) ActionDeactivate(resource *StorageDriver) (*StorageDriver, error) { + + resp := &StorageDriver{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverClient) ActionRemove(resource *StorageDriver) (*StorageDriver, error) { + + resp := &StorageDriver{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverClient) ActionUpdate(resource *StorageDriver) (*StorageDriver, error) { + + resp := &StorageDriver{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_storage_driver_service.go b/vendor/github.com/rancher/go-rancher/v2/generated_storage_driver_service.go new file mode 100644 index 0000000000..9fbc365eab --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_storage_driver_service.go @@ -0,0 +1,305 @@ +package client + +const ( + STORAGE_DRIVER_SERVICE_TYPE = "storageDriverService" +) + +type StorageDriverService struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AssignServiceIpAddress bool `json:"assignServiceIpAddress,omitempty" yaml:"assign_service_ip_address,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"` + + LbConfig *LbTargetConfig `json:"lbConfig,omitempty" yaml:"lb_config,omitempty"` + + LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"` + + Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RetainIp bool `json:"retainIp,omitempty" yaml:"retain_ip,omitempty"` + + Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + + SecondaryLaunchConfigs []SecondaryLaunchConfig `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"` + + SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` + + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StorageDriver StorageDriver `json:"storageDriver,omitempty" yaml:"storage_driver,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Upgrade *ServiceUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vip string `json:"vip,omitempty" yaml:"vip,omitempty"` +} + +type StorageDriverServiceCollection struct { + Collection + Data []StorageDriverService `json:"data,omitempty"` + client *StorageDriverServiceClient +} + +type StorageDriverServiceClient struct { + rancherClient *RancherClient +} + +type StorageDriverServiceOperations interface { + List(opts *ListOpts) (*StorageDriverServiceCollection, error) + Create(opts *StorageDriverService) (*StorageDriverService, error) + Update(existing *StorageDriverService, updates interface{}) (*StorageDriverService, error) + ById(id string) (*StorageDriverService, error) + Delete(container *StorageDriverService) error + + ActionActivate(*StorageDriverService) (*Service, error) + + ActionAddservicelink(*StorageDriverService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionCancelupgrade(*StorageDriverService) (*Service, error) + + ActionContinueupgrade(*StorageDriverService) (*Service, error) + + ActionCreate(*StorageDriverService) (*Service, error) + + ActionDeactivate(*StorageDriverService) (*Service, error) + + ActionFinishupgrade(*StorageDriverService) (*Service, error) + + ActionRemove(*StorageDriverService) (*Service, error) + + ActionRemoveservicelink(*StorageDriverService, *AddRemoveServiceLinkInput) (*Service, error) + + ActionRestart(*StorageDriverService, *ServiceRestart) (*Service, error) + + ActionRollback(*StorageDriverService) (*Service, error) + + ActionSetservicelinks(*StorageDriverService, *SetServiceLinksInput) (*Service, error) + + ActionUpdate(*StorageDriverService) (*Service, error) + + ActionUpgrade(*StorageDriverService, *ServiceUpgrade) (*Service, error) +} + +func newStorageDriverServiceClient(rancherClient *RancherClient) *StorageDriverServiceClient { + return &StorageDriverServiceClient{ + rancherClient: rancherClient, + } +} + +func (c *StorageDriverServiceClient) Create(container *StorageDriverService) (*StorageDriverService, error) { + resp := &StorageDriverService{} + err := c.rancherClient.doCreate(STORAGE_DRIVER_SERVICE_TYPE, container, resp) + return resp, err +} + +func (c *StorageDriverServiceClient) Update(existing *StorageDriverService, updates interface{}) (*StorageDriverService, error) { + resp := &StorageDriverService{} + err := c.rancherClient.doUpdate(STORAGE_DRIVER_SERVICE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StorageDriverServiceClient) List(opts *ListOpts) (*StorageDriverServiceCollection, error) { + resp := &StorageDriverServiceCollection{} + err := c.rancherClient.doList(STORAGE_DRIVER_SERVICE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StorageDriverServiceCollection) Next() (*StorageDriverServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StorageDriverServiceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StorageDriverServiceClient) ById(id string) (*StorageDriverService, error) { + resp := &StorageDriverService{} + err := c.rancherClient.doById(STORAGE_DRIVER_SERVICE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StorageDriverServiceClient) Delete(container *StorageDriverService) error { + return c.rancherClient.doResourceDelete(STORAGE_DRIVER_SERVICE_TYPE, &container.Resource) +} + +func (c *StorageDriverServiceClient) ActionActivate(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionAddservicelink(resource *StorageDriverService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionCancelupgrade(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "cancelupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionContinueupgrade(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionCreate(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionDeactivate(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionFinishupgrade(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "finishupgrade", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionRemove(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionRemoveservicelink(resource *StorageDriverService, input *AddRemoveServiceLinkInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionRestart(resource *StorageDriverService, input *ServiceRestart) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "restart", &resource.Resource, input, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionRollback(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "rollback", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionSetservicelinks(resource *StorageDriverService, input *SetServiceLinksInput) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionUpdate(resource *StorageDriverService) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StorageDriverServiceClient) ActionUpgrade(resource *StorageDriverService, input *ServiceUpgrade) (*Service, error) { + + resp := &Service{} + + err := c.rancherClient.doAction(STORAGE_DRIVER_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_storage_pool.go b/vendor/github.com/rancher/go-rancher/v2/generated_storage_pool.go new file mode 100644 index 0000000000..e77c382112 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_storage_pool.go @@ -0,0 +1,185 @@ +package client + +const ( + STORAGE_POOL_TYPE = "storagePool" +) + +type StoragePool struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + BlockDevicePath string `json:"blockDevicePath,omitempty" yaml:"block_device_path,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DriverName string `json:"driverName,omitempty" yaml:"driver_name,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HostIds []string `json:"hostIds,omitempty" yaml:"host_ids,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StorageDriverId string `json:"storageDriverId,omitempty" yaml:"storage_driver_id,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeAccessMode string `json:"volumeAccessMode,omitempty" yaml:"volume_access_mode,omitempty"` + + VolumeCapabilities []string `json:"volumeCapabilities,omitempty" yaml:"volume_capabilities,omitempty"` + + VolumeIds []string `json:"volumeIds,omitempty" yaml:"volume_ids,omitempty"` +} + +type StoragePoolCollection struct { + Collection + Data []StoragePool `json:"data,omitempty"` + client *StoragePoolClient +} + +type StoragePoolClient struct { + rancherClient *RancherClient +} + +type StoragePoolOperations interface { + List(opts *ListOpts) (*StoragePoolCollection, error) + Create(opts *StoragePool) (*StoragePool, error) + Update(existing *StoragePool, updates interface{}) (*StoragePool, error) + ById(id string) (*StoragePool, error) + Delete(container *StoragePool) error + + ActionActivate(*StoragePool) (*StoragePool, error) + + ActionCreate(*StoragePool) (*StoragePool, error) + + ActionDeactivate(*StoragePool) (*StoragePool, error) + + ActionPurge(*StoragePool) (*StoragePool, error) + + ActionRemove(*StoragePool) (*StoragePool, error) + + ActionUpdate(*StoragePool) (*StoragePool, error) +} + +func newStoragePoolClient(rancherClient *RancherClient) *StoragePoolClient { + return &StoragePoolClient{ + rancherClient: rancherClient, + } +} + +func (c *StoragePoolClient) Create(container *StoragePool) (*StoragePool, error) { + resp := &StoragePool{} + err := c.rancherClient.doCreate(STORAGE_POOL_TYPE, container, resp) + return resp, err +} + +func (c *StoragePoolClient) Update(existing *StoragePool, updates interface{}) (*StoragePool, error) { + resp := &StoragePool{} + err := c.rancherClient.doUpdate(STORAGE_POOL_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *StoragePoolClient) List(opts *ListOpts) (*StoragePoolCollection, error) { + resp := &StoragePoolCollection{} + err := c.rancherClient.doList(STORAGE_POOL_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *StoragePoolCollection) Next() (*StoragePoolCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &StoragePoolCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *StoragePoolClient) ById(id string) (*StoragePool, error) { + resp := &StoragePool{} + err := c.rancherClient.doById(STORAGE_POOL_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *StoragePoolClient) Delete(container *StoragePool) error { + return c.rancherClient.doResourceDelete(STORAGE_POOL_TYPE, &container.Resource) +} + +func (c *StoragePoolClient) ActionActivate(resource *StoragePool) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(STORAGE_POOL_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StoragePoolClient) ActionCreate(resource *StoragePool) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(STORAGE_POOL_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StoragePoolClient) ActionDeactivate(resource *StoragePool) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(STORAGE_POOL_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StoragePoolClient) ActionPurge(resource *StoragePool) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(STORAGE_POOL_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StoragePoolClient) ActionRemove(resource *StoragePool) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(STORAGE_POOL_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *StoragePoolClient) ActionUpdate(resource *StoragePool) (*StoragePool, error) { + + resp := &StoragePool{} + + err := c.rancherClient.doAction(STORAGE_POOL_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_subnet.go b/vendor/github.com/rancher/go-rancher/v2/generated_subnet.go new file mode 100644 index 0000000000..f1a7297002 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_subnet.go @@ -0,0 +1,181 @@ +package client + +const ( + SUBNET_TYPE = "subnet" +) + +type Subnet struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + CidrSize int64 `json:"cidrSize,omitempty" yaml:"cidr_size,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + EndAddress string `json:"endAddress,omitempty" yaml:"end_address,omitempty"` + + Gateway string `json:"gateway,omitempty" yaml:"gateway,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NetworkAddress string `json:"networkAddress,omitempty" yaml:"network_address,omitempty"` + + NetworkId string `json:"networkId,omitempty" yaml:"network_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + StartAddress string `json:"startAddress,omitempty" yaml:"start_address,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type SubnetCollection struct { + Collection + Data []Subnet `json:"data,omitempty"` + client *SubnetClient +} + +type SubnetClient struct { + rancherClient *RancherClient +} + +type SubnetOperations interface { + List(opts *ListOpts) (*SubnetCollection, error) + Create(opts *Subnet) (*Subnet, error) + Update(existing *Subnet, updates interface{}) (*Subnet, error) + ById(id string) (*Subnet, error) + Delete(container *Subnet) error + + ActionActivate(*Subnet) (*Subnet, error) + + ActionCreate(*Subnet) (*Subnet, error) + + ActionDeactivate(*Subnet) (*Subnet, error) + + ActionPurge(*Subnet) (*Subnet, error) + + ActionRemove(*Subnet) (*Subnet, error) + + ActionUpdate(*Subnet) (*Subnet, error) +} + +func newSubnetClient(rancherClient *RancherClient) *SubnetClient { + return &SubnetClient{ + rancherClient: rancherClient, + } +} + +func (c *SubnetClient) Create(container *Subnet) (*Subnet, error) { + resp := &Subnet{} + err := c.rancherClient.doCreate(SUBNET_TYPE, container, resp) + return resp, err +} + +func (c *SubnetClient) Update(existing *Subnet, updates interface{}) (*Subnet, error) { + resp := &Subnet{} + err := c.rancherClient.doUpdate(SUBNET_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *SubnetClient) List(opts *ListOpts) (*SubnetCollection, error) { + resp := &SubnetCollection{} + err := c.rancherClient.doList(SUBNET_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *SubnetCollection) Next() (*SubnetCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &SubnetCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *SubnetClient) ById(id string) (*Subnet, error) { + resp := &Subnet{} + err := c.rancherClient.doById(SUBNET_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *SubnetClient) Delete(container *Subnet) error { + return c.rancherClient.doResourceDelete(SUBNET_TYPE, &container.Resource) +} + +func (c *SubnetClient) ActionActivate(resource *Subnet) (*Subnet, error) { + + resp := &Subnet{} + + err := c.rancherClient.doAction(SUBNET_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SubnetClient) ActionCreate(resource *Subnet) (*Subnet, error) { + + resp := &Subnet{} + + err := c.rancherClient.doAction(SUBNET_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SubnetClient) ActionDeactivate(resource *Subnet) (*Subnet, error) { + + resp := &Subnet{} + + err := c.rancherClient.doAction(SUBNET_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SubnetClient) ActionPurge(resource *Subnet) (*Subnet, error) { + + resp := &Subnet{} + + err := c.rancherClient.doAction(SUBNET_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SubnetClient) ActionRemove(resource *Subnet) (*Subnet, error) { + + resp := &Subnet{} + + err := c.rancherClient.doAction(SUBNET_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *SubnetClient) ActionUpdate(resource *Subnet) (*Subnet, error) { + + resp := &Subnet{} + + err := c.rancherClient.doAction(SUBNET_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_target_port_rule.go b/vendor/github.com/rancher/go-rancher/v2/generated_target_port_rule.go new file mode 100644 index 0000000000..2acc18066d --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_target_port_rule.go @@ -0,0 +1,85 @@ +package client + +const ( + TARGET_PORT_RULE_TYPE = "targetPortRule" +) + +type TargetPortRule struct { + Resource + + BackendName string `json:"backendName,omitempty" yaml:"backend_name,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + Path string `json:"path,omitempty" yaml:"path,omitempty"` + + TargetPort int64 `json:"targetPort,omitempty" yaml:"target_port,omitempty"` +} + +type TargetPortRuleCollection struct { + Collection + Data []TargetPortRule `json:"data,omitempty"` + client *TargetPortRuleClient +} + +type TargetPortRuleClient struct { + rancherClient *RancherClient +} + +type TargetPortRuleOperations interface { + List(opts *ListOpts) (*TargetPortRuleCollection, error) + Create(opts *TargetPortRule) (*TargetPortRule, error) + Update(existing *TargetPortRule, updates interface{}) (*TargetPortRule, error) + ById(id string) (*TargetPortRule, error) + Delete(container *TargetPortRule) error +} + +func newTargetPortRuleClient(rancherClient *RancherClient) *TargetPortRuleClient { + return &TargetPortRuleClient{ + rancherClient: rancherClient, + } +} + +func (c *TargetPortRuleClient) Create(container *TargetPortRule) (*TargetPortRule, error) { + resp := &TargetPortRule{} + err := c.rancherClient.doCreate(TARGET_PORT_RULE_TYPE, container, resp) + return resp, err +} + +func (c *TargetPortRuleClient) Update(existing *TargetPortRule, updates interface{}) (*TargetPortRule, error) { + resp := &TargetPortRule{} + err := c.rancherClient.doUpdate(TARGET_PORT_RULE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *TargetPortRuleClient) List(opts *ListOpts) (*TargetPortRuleCollection, error) { + resp := &TargetPortRuleCollection{} + err := c.rancherClient.doList(TARGET_PORT_RULE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *TargetPortRuleCollection) Next() (*TargetPortRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &TargetPortRuleCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *TargetPortRuleClient) ById(id string) (*TargetPortRule, error) { + resp := &TargetPortRule{} + err := c.rancherClient.doById(TARGET_PORT_RULE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *TargetPortRuleClient) Delete(container *TargetPortRule) error { + return c.rancherClient.doResourceDelete(TARGET_PORT_RULE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_task.go b/vendor/github.com/rancher/go-rancher/v2/generated_task.go new file mode 100644 index 0000000000..8fa65e2dbc --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_task.go @@ -0,0 +1,90 @@ +package client + +const ( + TASK_TYPE = "task" +) + +type Task struct { + Resource + + Name string `json:"name,omitempty" yaml:"name,omitempty"` +} + +type TaskCollection struct { + Collection + Data []Task `json:"data,omitempty"` + client *TaskClient +} + +type TaskClient struct { + rancherClient *RancherClient +} + +type TaskOperations interface { + List(opts *ListOpts) (*TaskCollection, error) + Create(opts *Task) (*Task, error) + Update(existing *Task, updates interface{}) (*Task, error) + ById(id string) (*Task, error) + Delete(container *Task) error + + ActionExecute(*Task) (*Task, error) +} + +func newTaskClient(rancherClient *RancherClient) *TaskClient { + return &TaskClient{ + rancherClient: rancherClient, + } +} + +func (c *TaskClient) Create(container *Task) (*Task, error) { + resp := &Task{} + err := c.rancherClient.doCreate(TASK_TYPE, container, resp) + return resp, err +} + +func (c *TaskClient) Update(existing *Task, updates interface{}) (*Task, error) { + resp := &Task{} + err := c.rancherClient.doUpdate(TASK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *TaskClient) List(opts *ListOpts) (*TaskCollection, error) { + resp := &TaskCollection{} + err := c.rancherClient.doList(TASK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *TaskCollection) Next() (*TaskCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &TaskCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *TaskClient) ById(id string) (*Task, error) { + resp := &Task{} + err := c.rancherClient.doById(TASK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *TaskClient) Delete(container *Task) error { + return c.rancherClient.doResourceDelete(TASK_TYPE, &container.Resource) +} + +func (c *TaskClient) ActionExecute(resource *Task) (*Task, error) { + + resp := &Task{} + + err := c.rancherClient.doAction(TASK_TYPE, "execute", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_task_instance.go b/vendor/github.com/rancher/go-rancher/v2/generated_task_instance.go new file mode 100644 index 0000000000..5bb58273e2 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_task_instance.go @@ -0,0 +1,89 @@ +package client + +const ( + TASK_INSTANCE_TYPE = "taskInstance" +) + +type TaskInstance struct { + Resource + + EndTime string `json:"endTime,omitempty" yaml:"end_time,omitempty"` + + Exception string `json:"exception,omitempty" yaml:"exception,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + ServerId string `json:"serverId,omitempty" yaml:"server_id,omitempty"` + + StartTime string `json:"startTime,omitempty" yaml:"start_time,omitempty"` + + TaskId string `json:"taskId,omitempty" yaml:"task_id,omitempty"` +} + +type TaskInstanceCollection struct { + Collection + Data []TaskInstance `json:"data,omitempty"` + client *TaskInstanceClient +} + +type TaskInstanceClient struct { + rancherClient *RancherClient +} + +type TaskInstanceOperations interface { + List(opts *ListOpts) (*TaskInstanceCollection, error) + Create(opts *TaskInstance) (*TaskInstance, error) + Update(existing *TaskInstance, updates interface{}) (*TaskInstance, error) + ById(id string) (*TaskInstance, error) + Delete(container *TaskInstance) error +} + +func newTaskInstanceClient(rancherClient *RancherClient) *TaskInstanceClient { + return &TaskInstanceClient{ + rancherClient: rancherClient, + } +} + +func (c *TaskInstanceClient) Create(container *TaskInstance) (*TaskInstance, error) { + resp := &TaskInstance{} + err := c.rancherClient.doCreate(TASK_INSTANCE_TYPE, container, resp) + return resp, err +} + +func (c *TaskInstanceClient) Update(existing *TaskInstance, updates interface{}) (*TaskInstance, error) { + resp := &TaskInstance{} + err := c.rancherClient.doUpdate(TASK_INSTANCE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *TaskInstanceClient) List(opts *ListOpts) (*TaskInstanceCollection, error) { + resp := &TaskInstanceCollection{} + err := c.rancherClient.doList(TASK_INSTANCE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *TaskInstanceCollection) Next() (*TaskInstanceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &TaskInstanceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *TaskInstanceClient) ById(id string) (*TaskInstance, error) { + resp := &TaskInstance{} + err := c.rancherClient.doById(TASK_INSTANCE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *TaskInstanceClient) Delete(container *TaskInstance) error { + return c.rancherClient.doResourceDelete(TASK_INSTANCE_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_to_service_upgrade_strategy.go b/vendor/github.com/rancher/go-rancher/v2/generated_to_service_upgrade_strategy.go new file mode 100644 index 0000000000..3ed74115c9 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_to_service_upgrade_strategy.go @@ -0,0 +1,87 @@ +package client + +const ( + TO_SERVICE_UPGRADE_STRATEGY_TYPE = "toServiceUpgradeStrategy" +) + +type ToServiceUpgradeStrategy struct { + Resource + + BatchSize int64 `json:"batchSize,omitempty" yaml:"batch_size,omitempty"` + + FinalScale int64 `json:"finalScale,omitempty" yaml:"final_scale,omitempty"` + + IntervalMillis int64 `json:"intervalMillis,omitempty" yaml:"interval_millis,omitempty"` + + ToServiceId string `json:"toServiceId,omitempty" yaml:"to_service_id,omitempty"` + + UpdateLinks bool `json:"updateLinks,omitempty" yaml:"update_links,omitempty"` +} + +type ToServiceUpgradeStrategyCollection struct { + Collection + Data []ToServiceUpgradeStrategy `json:"data,omitempty"` + client *ToServiceUpgradeStrategyClient +} + +type ToServiceUpgradeStrategyClient struct { + rancherClient *RancherClient +} + +type ToServiceUpgradeStrategyOperations interface { + List(opts *ListOpts) (*ToServiceUpgradeStrategyCollection, error) + Create(opts *ToServiceUpgradeStrategy) (*ToServiceUpgradeStrategy, error) + Update(existing *ToServiceUpgradeStrategy, updates interface{}) (*ToServiceUpgradeStrategy, error) + ById(id string) (*ToServiceUpgradeStrategy, error) + Delete(container *ToServiceUpgradeStrategy) error +} + +func newToServiceUpgradeStrategyClient(rancherClient *RancherClient) *ToServiceUpgradeStrategyClient { + return &ToServiceUpgradeStrategyClient{ + rancherClient: rancherClient, + } +} + +func (c *ToServiceUpgradeStrategyClient) Create(container *ToServiceUpgradeStrategy) (*ToServiceUpgradeStrategy, error) { + resp := &ToServiceUpgradeStrategy{} + err := c.rancherClient.doCreate(TO_SERVICE_UPGRADE_STRATEGY_TYPE, container, resp) + return resp, err +} + +func (c *ToServiceUpgradeStrategyClient) Update(existing *ToServiceUpgradeStrategy, updates interface{}) (*ToServiceUpgradeStrategy, error) { + resp := &ToServiceUpgradeStrategy{} + err := c.rancherClient.doUpdate(TO_SERVICE_UPGRADE_STRATEGY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ToServiceUpgradeStrategyClient) List(opts *ListOpts) (*ToServiceUpgradeStrategyCollection, error) { + resp := &ToServiceUpgradeStrategyCollection{} + err := c.rancherClient.doList(TO_SERVICE_UPGRADE_STRATEGY_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ToServiceUpgradeStrategyCollection) Next() (*ToServiceUpgradeStrategyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ToServiceUpgradeStrategyCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ToServiceUpgradeStrategyClient) ById(id string) (*ToServiceUpgradeStrategy, error) { + resp := &ToServiceUpgradeStrategy{} + err := c.rancherClient.doById(TO_SERVICE_UPGRADE_STRATEGY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ToServiceUpgradeStrategyClient) Delete(container *ToServiceUpgradeStrategy) error { + return c.rancherClient.doResourceDelete(TO_SERVICE_UPGRADE_STRATEGY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_type_documentation.go b/vendor/github.com/rancher/go-rancher/v2/generated_type_documentation.go new file mode 100644 index 0000000000..cdfe186490 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_type_documentation.go @@ -0,0 +1,81 @@ +package client + +const ( + TYPE_DOCUMENTATION_TYPE = "typeDocumentation" +) + +type TypeDocumentation struct { + Resource + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + ResourceFields map[string]interface{} `json:"resourceFields,omitempty" yaml:"resource_fields,omitempty"` +} + +type TypeDocumentationCollection struct { + Collection + Data []TypeDocumentation `json:"data,omitempty"` + client *TypeDocumentationClient +} + +type TypeDocumentationClient struct { + rancherClient *RancherClient +} + +type TypeDocumentationOperations interface { + List(opts *ListOpts) (*TypeDocumentationCollection, error) + Create(opts *TypeDocumentation) (*TypeDocumentation, error) + Update(existing *TypeDocumentation, updates interface{}) (*TypeDocumentation, error) + ById(id string) (*TypeDocumentation, error) + Delete(container *TypeDocumentation) error +} + +func newTypeDocumentationClient(rancherClient *RancherClient) *TypeDocumentationClient { + return &TypeDocumentationClient{ + rancherClient: rancherClient, + } +} + +func (c *TypeDocumentationClient) Create(container *TypeDocumentation) (*TypeDocumentation, error) { + resp := &TypeDocumentation{} + err := c.rancherClient.doCreate(TYPE_DOCUMENTATION_TYPE, container, resp) + return resp, err +} + +func (c *TypeDocumentationClient) Update(existing *TypeDocumentation, updates interface{}) (*TypeDocumentation, error) { + resp := &TypeDocumentation{} + err := c.rancherClient.doUpdate(TYPE_DOCUMENTATION_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *TypeDocumentationClient) List(opts *ListOpts) (*TypeDocumentationCollection, error) { + resp := &TypeDocumentationCollection{} + err := c.rancherClient.doList(TYPE_DOCUMENTATION_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *TypeDocumentationCollection) Next() (*TypeDocumentationCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &TypeDocumentationCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *TypeDocumentationClient) ById(id string) (*TypeDocumentation, error) { + resp := &TypeDocumentation{} + err := c.rancherClient.doById(TYPE_DOCUMENTATION_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *TypeDocumentationClient) Delete(container *TypeDocumentation) error { + return c.rancherClient.doResourceDelete(TYPE_DOCUMENTATION_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_ulimit.go b/vendor/github.com/rancher/go-rancher/v2/generated_ulimit.go new file mode 100644 index 0000000000..7449c263b0 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_ulimit.go @@ -0,0 +1,83 @@ +package client + +const ( + ULIMIT_TYPE = "ulimit" +) + +type Ulimit struct { + Resource + + Hard int64 `json:"hard,omitempty" yaml:"hard,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Soft int64 `json:"soft,omitempty" yaml:"soft,omitempty"` +} + +type UlimitCollection struct { + Collection + Data []Ulimit `json:"data,omitempty"` + client *UlimitClient +} + +type UlimitClient struct { + rancherClient *RancherClient +} + +type UlimitOperations interface { + List(opts *ListOpts) (*UlimitCollection, error) + Create(opts *Ulimit) (*Ulimit, error) + Update(existing *Ulimit, updates interface{}) (*Ulimit, error) + ById(id string) (*Ulimit, error) + Delete(container *Ulimit) error +} + +func newUlimitClient(rancherClient *RancherClient) *UlimitClient { + return &UlimitClient{ + rancherClient: rancherClient, + } +} + +func (c *UlimitClient) Create(container *Ulimit) (*Ulimit, error) { + resp := &Ulimit{} + err := c.rancherClient.doCreate(ULIMIT_TYPE, container, resp) + return resp, err +} + +func (c *UlimitClient) Update(existing *Ulimit, updates interface{}) (*Ulimit, error) { + resp := &Ulimit{} + err := c.rancherClient.doUpdate(ULIMIT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *UlimitClient) List(opts *ListOpts) (*UlimitCollection, error) { + resp := &UlimitCollection{} + err := c.rancherClient.doList(ULIMIT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *UlimitCollection) Next() (*UlimitCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &UlimitCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *UlimitClient) ById(id string) (*Ulimit, error) { + resp := &Ulimit{} + err := c.rancherClient.doById(ULIMIT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *UlimitClient) Delete(container *Ulimit) error { + return c.rancherClient.doResourceDelete(ULIMIT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_user_preference.go b/vendor/github.com/rancher/go-rancher/v2/generated_user_preference.go new file mode 100644 index 0000000000..815b87ddfb --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_user_preference.go @@ -0,0 +1,173 @@ +package client + +const ( + USER_PREFERENCE_TYPE = "userPreference" +) + +type UserPreference struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + All bool `json:"all,omitempty" yaml:"all,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type UserPreferenceCollection struct { + Collection + Data []UserPreference `json:"data,omitempty"` + client *UserPreferenceClient +} + +type UserPreferenceClient struct { + rancherClient *RancherClient +} + +type UserPreferenceOperations interface { + List(opts *ListOpts) (*UserPreferenceCollection, error) + Create(opts *UserPreference) (*UserPreference, error) + Update(existing *UserPreference, updates interface{}) (*UserPreference, error) + ById(id string) (*UserPreference, error) + Delete(container *UserPreference) error + + ActionActivate(*UserPreference) (*UserPreference, error) + + ActionCreate(*UserPreference) (*UserPreference, error) + + ActionDeactivate(*UserPreference) (*UserPreference, error) + + ActionPurge(*UserPreference) (*UserPreference, error) + + ActionRemove(*UserPreference) (*UserPreference, error) + + ActionUpdate(*UserPreference) (*UserPreference, error) +} + +func newUserPreferenceClient(rancherClient *RancherClient) *UserPreferenceClient { + return &UserPreferenceClient{ + rancherClient: rancherClient, + } +} + +func (c *UserPreferenceClient) Create(container *UserPreference) (*UserPreference, error) { + resp := &UserPreference{} + err := c.rancherClient.doCreate(USER_PREFERENCE_TYPE, container, resp) + return resp, err +} + +func (c *UserPreferenceClient) Update(existing *UserPreference, updates interface{}) (*UserPreference, error) { + resp := &UserPreference{} + err := c.rancherClient.doUpdate(USER_PREFERENCE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *UserPreferenceClient) List(opts *ListOpts) (*UserPreferenceCollection, error) { + resp := &UserPreferenceCollection{} + err := c.rancherClient.doList(USER_PREFERENCE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *UserPreferenceCollection) Next() (*UserPreferenceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &UserPreferenceCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *UserPreferenceClient) ById(id string) (*UserPreference, error) { + resp := &UserPreference{} + err := c.rancherClient.doById(USER_PREFERENCE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *UserPreferenceClient) Delete(container *UserPreference) error { + return c.rancherClient.doResourceDelete(USER_PREFERENCE_TYPE, &container.Resource) +} + +func (c *UserPreferenceClient) ActionActivate(resource *UserPreference) (*UserPreference, error) { + + resp := &UserPreference{} + + err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *UserPreferenceClient) ActionCreate(resource *UserPreference) (*UserPreference, error) { + + resp := &UserPreference{} + + err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *UserPreferenceClient) ActionDeactivate(resource *UserPreference) (*UserPreference, error) { + + resp := &UserPreference{} + + err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *UserPreferenceClient) ActionPurge(resource *UserPreference) (*UserPreference, error) { + + resp := &UserPreference{} + + err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *UserPreferenceClient) ActionRemove(resource *UserPreference) (*UserPreference, error) { + + resp := &UserPreference{} + + err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *UserPreferenceClient) ActionUpdate(resource *UserPreference) (*UserPreference, error) { + + resp := &UserPreference{} + + err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine.go b/vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine.go new file mode 100644 index 0000000000..69327b2f1b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine.go @@ -0,0 +1,485 @@ +package client + +const ( + VIRTUAL_MACHINE_TYPE = "virtualMachine" +) + +type VirtualMachine struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` + + AllocationState string `json:"allocationState,omitempty" yaml:"allocation_state,omitempty"` + + BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"` + + BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"` + + CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"` + + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + + Count int64 `json:"count,omitempty" yaml:"count,omitempty"` + + CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"` + + CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"` + + CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"` + + CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"` + + CpuRealtimePeriod int64 `json:"cpuRealtimePeriod,omitempty" yaml:"cpu_realtime_period,omitempty"` + + CpuRealtimeRuntime int64 `json:"cpuRealtimeRuntime,omitempty" yaml:"cpu_realtime_runtime,omitempty"` + + CpuSet string `json:"cpuSet,omitempty" yaml:"cpu_set,omitempty"` + + CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"` + + CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"` + + CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + DeploymentUnitUuid string `json:"deploymentUnitUuid,omitempty" yaml:"deployment_unit_uuid,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"` + + Disks []VirtualMachineDisk `json:"disks,omitempty" yaml:"disks,omitempty"` + + Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"` + + DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"` + + DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"` + + DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"` + + Expose []string `json:"expose,omitempty" yaml:"expose,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + ExtraHosts []string `json:"extraHosts,omitempty" yaml:"extra_hosts,omitempty"` + + FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"` + + GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"` + + HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"` + + HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"` + + HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"` + + HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"` + + HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"` + + HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` + + ImageUuid string `json:"imageUuid,omitempty" yaml:"image_uuid,omitempty"` + + InstanceLinks map[string]interface{} `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"` + + InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"` + + IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"` + + IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"` + + Ip string `json:"ip,omitempty" yaml:"ip,omitempty"` + + Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"` + + IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"` + + Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"` + + KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"` + + LogConfig *LogConfig `json:"logConfig,omitempty" yaml:"log_config,omitempty"` + + Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"` + + MemoryMb int64 `json:"memoryMb,omitempty" yaml:"memory_mb,omitempty"` + + MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"` + + MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"` + + MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"` + + MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"` + + Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"` + + NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"` + + NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"` + + NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"` + + OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"` + + OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"` + + PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"` + + Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"` + + PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"` + + PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"` + + RegistryCredentialId string `json:"registryCredentialId,omitempty" yaml:"registry_credential_id,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + RequestedHostId string `json:"requestedHostId,omitempty" yaml:"requested_host_id,omitempty"` + + RestartPolicy *RestartPolicy `json:"restartPolicy,omitempty" yaml:"restart_policy,omitempty"` + + RunInit bool `json:"runInit,omitempty" yaml:"run_init,omitempty"` + + SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"` + + ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"` + + ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"` + + ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"` + + StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"` + + StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"` + + StorageOpt map[string]interface{} `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"` + + Sysctls map[string]interface{} `json:"sysctls,omitempty" yaml:"sysctls,omitempty"` + + System bool `json:"system,omitempty" yaml:"system,omitempty"` + + Tmpfs map[string]interface{} `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"` + + Token string `json:"token,omitempty" yaml:"token,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"` + + UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"` + + Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"` + + UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"` + + Uts string `json:"uts,omitempty" yaml:"uts,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + Vcpu int64 `json:"vcpu,omitempty" yaml:"vcpu,omitempty"` + + Version string `json:"version,omitempty" yaml:"version,omitempty"` + + VolumeDriver string `json:"volumeDriver,omitempty" yaml:"volume_driver,omitempty"` +} + +type VirtualMachineCollection struct { + Collection + Data []VirtualMachine `json:"data,omitempty"` + client *VirtualMachineClient +} + +type VirtualMachineClient struct { + rancherClient *RancherClient +} + +type VirtualMachineOperations interface { + List(opts *ListOpts) (*VirtualMachineCollection, error) + Create(opts *VirtualMachine) (*VirtualMachine, error) + Update(existing *VirtualMachine, updates interface{}) (*VirtualMachine, error) + ById(id string) (*VirtualMachine, error) + Delete(container *VirtualMachine) error + + ActionAllocate(*VirtualMachine) (*Instance, error) + + ActionConsole(*VirtualMachine, *InstanceConsoleInput) (*InstanceConsole, error) + + ActionCreate(*VirtualMachine) (*Instance, error) + + ActionDeallocate(*VirtualMachine) (*Instance, error) + + ActionError(*VirtualMachine) (*Instance, error) + + ActionExecute(*VirtualMachine, *ContainerExec) (*HostAccess, error) + + ActionLogs(*VirtualMachine, *ContainerLogs) (*HostAccess, error) + + ActionMigrate(*VirtualMachine) (*Instance, error) + + ActionProxy(*VirtualMachine, *ContainerProxy) (*HostAccess, error) + + ActionPurge(*VirtualMachine) (*Instance, error) + + ActionRemove(*VirtualMachine) (*Instance, error) + + ActionRestart(*VirtualMachine) (*Instance, error) + + ActionStart(*VirtualMachine) (*Instance, error) + + ActionStop(*VirtualMachine, *InstanceStop) (*Instance, error) + + ActionUpdate(*VirtualMachine) (*Instance, error) + + ActionUpdatehealthy(*VirtualMachine) (*Instance, error) + + ActionUpdatereinitializing(*VirtualMachine) (*Instance, error) + + ActionUpdateunhealthy(*VirtualMachine) (*Instance, error) +} + +func newVirtualMachineClient(rancherClient *RancherClient) *VirtualMachineClient { + return &VirtualMachineClient{ + rancherClient: rancherClient, + } +} + +func (c *VirtualMachineClient) Create(container *VirtualMachine) (*VirtualMachine, error) { + resp := &VirtualMachine{} + err := c.rancherClient.doCreate(VIRTUAL_MACHINE_TYPE, container, resp) + return resp, err +} + +func (c *VirtualMachineClient) Update(existing *VirtualMachine, updates interface{}) (*VirtualMachine, error) { + resp := &VirtualMachine{} + err := c.rancherClient.doUpdate(VIRTUAL_MACHINE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VirtualMachineClient) List(opts *ListOpts) (*VirtualMachineCollection, error) { + resp := &VirtualMachineCollection{} + err := c.rancherClient.doList(VIRTUAL_MACHINE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VirtualMachineCollection) Next() (*VirtualMachineCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VirtualMachineCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VirtualMachineClient) ById(id string) (*VirtualMachine, error) { + resp := &VirtualMachine{} + err := c.rancherClient.doById(VIRTUAL_MACHINE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *VirtualMachineClient) Delete(container *VirtualMachine) error { + return c.rancherClient.doResourceDelete(VIRTUAL_MACHINE_TYPE, &container.Resource) +} + +func (c *VirtualMachineClient) ActionAllocate(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "allocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionConsole(resource *VirtualMachine, input *InstanceConsoleInput) (*InstanceConsole, error) { + + resp := &InstanceConsole{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "console", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionCreate(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionDeallocate(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "deallocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionError(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "error", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionExecute(resource *VirtualMachine, input *ContainerExec) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "execute", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionLogs(resource *VirtualMachine, input *ContainerLogs) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "logs", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionMigrate(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "migrate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionProxy(resource *VirtualMachine, input *ContainerProxy) (*HostAccess, error) { + + resp := &HostAccess{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "proxy", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionPurge(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionRemove(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionRestart(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "restart", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionStart(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "start", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionStop(resource *VirtualMachine, input *InstanceStop) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "stop", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionUpdate(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionUpdatehealthy(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "updatehealthy", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionUpdatereinitializing(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "updatereinitializing", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VirtualMachineClient) ActionUpdateunhealthy(resource *VirtualMachine) (*Instance, error) { + + resp := &Instance{} + + err := c.rancherClient.doAction(VIRTUAL_MACHINE_TYPE, "updateunhealthy", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine_disk.go b/vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine_disk.go new file mode 100644 index 0000000000..af52418d3e --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_virtual_machine_disk.go @@ -0,0 +1,91 @@ +package client + +const ( + VIRTUAL_MACHINE_DISK_TYPE = "virtualMachineDisk" +) + +type VirtualMachineDisk struct { + Resource + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + Opts map[string]interface{} `json:"opts,omitempty" yaml:"opts,omitempty"` + + ReadIops int64 `json:"readIops,omitempty" yaml:"read_iops,omitempty"` + + Root bool `json:"root,omitempty" yaml:"root,omitempty"` + + Size string `json:"size,omitempty" yaml:"size,omitempty"` + + WriteIops int64 `json:"writeIops,omitempty" yaml:"write_iops,omitempty"` +} + +type VirtualMachineDiskCollection struct { + Collection + Data []VirtualMachineDisk `json:"data,omitempty"` + client *VirtualMachineDiskClient +} + +type VirtualMachineDiskClient struct { + rancherClient *RancherClient +} + +type VirtualMachineDiskOperations interface { + List(opts *ListOpts) (*VirtualMachineDiskCollection, error) + Create(opts *VirtualMachineDisk) (*VirtualMachineDisk, error) + Update(existing *VirtualMachineDisk, updates interface{}) (*VirtualMachineDisk, error) + ById(id string) (*VirtualMachineDisk, error) + Delete(container *VirtualMachineDisk) error +} + +func newVirtualMachineDiskClient(rancherClient *RancherClient) *VirtualMachineDiskClient { + return &VirtualMachineDiskClient{ + rancherClient: rancherClient, + } +} + +func (c *VirtualMachineDiskClient) Create(container *VirtualMachineDisk) (*VirtualMachineDisk, error) { + resp := &VirtualMachineDisk{} + err := c.rancherClient.doCreate(VIRTUAL_MACHINE_DISK_TYPE, container, resp) + return resp, err +} + +func (c *VirtualMachineDiskClient) Update(existing *VirtualMachineDisk, updates interface{}) (*VirtualMachineDisk, error) { + resp := &VirtualMachineDisk{} + err := c.rancherClient.doUpdate(VIRTUAL_MACHINE_DISK_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VirtualMachineDiskClient) List(opts *ListOpts) (*VirtualMachineDiskCollection, error) { + resp := &VirtualMachineDiskCollection{} + err := c.rancherClient.doList(VIRTUAL_MACHINE_DISK_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VirtualMachineDiskCollection) Next() (*VirtualMachineDiskCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VirtualMachineDiskCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VirtualMachineDiskClient) ById(id string) (*VirtualMachineDisk, error) { + resp := &VirtualMachineDisk{} + err := c.rancherClient.doById(VIRTUAL_MACHINE_DISK_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *VirtualMachineDiskClient) Delete(container *VirtualMachineDisk) error { + return c.rancherClient.doResourceDelete(VIRTUAL_MACHINE_DISK_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_volume.go b/vendor/github.com/rancher/go-rancher/v2/generated_volume.go new file mode 100644 index 0000000000..00b4e5dd4f --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_volume.go @@ -0,0 +1,230 @@ +package client + +const ( + VOLUME_TYPE = "volume" +) + +type Volume struct { + Resource + + AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"` + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + DriverOpts map[string]interface{} `json:"driverOpts,omitempty" yaml:"driver_opts,omitempty"` + + ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` + + ImageId string `json:"imageId,omitempty" yaml:"image_id,omitempty"` + + InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"` + + IsHostPath bool `json:"isHostPath,omitempty" yaml:"is_host_path,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + SizeMb int64 `json:"sizeMb,omitempty" yaml:"size_mb,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + StorageDriverId string `json:"storageDriverId,omitempty" yaml:"storage_driver_id,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + + VolumeTemplateId string `json:"volumeTemplateId,omitempty" yaml:"volume_template_id,omitempty"` +} + +type VolumeCollection struct { + Collection + Data []Volume `json:"data,omitempty"` + client *VolumeClient +} + +type VolumeClient struct { + rancherClient *RancherClient +} + +type VolumeOperations interface { + List(opts *ListOpts) (*VolumeCollection, error) + Create(opts *Volume) (*Volume, error) + Update(existing *Volume, updates interface{}) (*Volume, error) + ById(id string) (*Volume, error) + Delete(container *Volume) error + + ActionAllocate(*Volume) (*Volume, error) + + ActionCreate(*Volume) (*Volume, error) + + ActionDeallocate(*Volume) (*Volume, error) + + ActionPurge(*Volume) (*Volume, error) + + ActionRemove(*Volume) (*Volume, error) + + ActionRestorefrombackup(*Volume, *RestoreFromBackupInput) (*Volume, error) + + ActionReverttosnapshot(*Volume, *RevertToSnapshotInput) (*Volume, error) + + ActionSnapshot(*Volume, *VolumeSnapshotInput) (*Snapshot, error) + + ActionUpdate(*Volume) (*Volume, error) +} + +func newVolumeClient(rancherClient *RancherClient) *VolumeClient { + return &VolumeClient{ + rancherClient: rancherClient, + } +} + +func (c *VolumeClient) Create(container *Volume) (*Volume, error) { + resp := &Volume{} + err := c.rancherClient.doCreate(VOLUME_TYPE, container, resp) + return resp, err +} + +func (c *VolumeClient) Update(existing *Volume, updates interface{}) (*Volume, error) { + resp := &Volume{} + err := c.rancherClient.doUpdate(VOLUME_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VolumeClient) List(opts *ListOpts) (*VolumeCollection, error) { + resp := &VolumeCollection{} + err := c.rancherClient.doList(VOLUME_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VolumeCollection) Next() (*VolumeCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VolumeCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VolumeClient) ById(id string) (*Volume, error) { + resp := &Volume{} + err := c.rancherClient.doById(VOLUME_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *VolumeClient) Delete(container *Volume) error { + return c.rancherClient.doResourceDelete(VOLUME_TYPE, &container.Resource) +} + +func (c *VolumeClient) ActionAllocate(resource *Volume) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "allocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeClient) ActionCreate(resource *Volume) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeClient) ActionDeallocate(resource *Volume) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "deallocate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeClient) ActionPurge(resource *Volume) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeClient) ActionRemove(resource *Volume) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeClient) ActionRestorefrombackup(resource *Volume, input *RestoreFromBackupInput) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "restorefrombackup", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VolumeClient) ActionReverttosnapshot(resource *Volume, input *RevertToSnapshotInput) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "reverttosnapshot", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VolumeClient) ActionSnapshot(resource *Volume, input *VolumeSnapshotInput) (*Snapshot, error) { + + resp := &Snapshot{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "snapshot", &resource.Resource, input, resp) + + return resp, err +} + +func (c *VolumeClient) ActionUpdate(resource *Volume) (*Volume, error) { + + resp := &Volume{} + + err := c.rancherClient.doAction(VOLUME_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_volume_activate_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_volume_activate_input.go new file mode 100644 index 0000000000..be4269a6e3 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_volume_activate_input.go @@ -0,0 +1,79 @@ +package client + +const ( + VOLUME_ACTIVATE_INPUT_TYPE = "volumeActivateInput" +) + +type VolumeActivateInput struct { + Resource + + HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"` +} + +type VolumeActivateInputCollection struct { + Collection + Data []VolumeActivateInput `json:"data,omitempty"` + client *VolumeActivateInputClient +} + +type VolumeActivateInputClient struct { + rancherClient *RancherClient +} + +type VolumeActivateInputOperations interface { + List(opts *ListOpts) (*VolumeActivateInputCollection, error) + Create(opts *VolumeActivateInput) (*VolumeActivateInput, error) + Update(existing *VolumeActivateInput, updates interface{}) (*VolumeActivateInput, error) + ById(id string) (*VolumeActivateInput, error) + Delete(container *VolumeActivateInput) error +} + +func newVolumeActivateInputClient(rancherClient *RancherClient) *VolumeActivateInputClient { + return &VolumeActivateInputClient{ + rancherClient: rancherClient, + } +} + +func (c *VolumeActivateInputClient) Create(container *VolumeActivateInput) (*VolumeActivateInput, error) { + resp := &VolumeActivateInput{} + err := c.rancherClient.doCreate(VOLUME_ACTIVATE_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *VolumeActivateInputClient) Update(existing *VolumeActivateInput, updates interface{}) (*VolumeActivateInput, error) { + resp := &VolumeActivateInput{} + err := c.rancherClient.doUpdate(VOLUME_ACTIVATE_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VolumeActivateInputClient) List(opts *ListOpts) (*VolumeActivateInputCollection, error) { + resp := &VolumeActivateInputCollection{} + err := c.rancherClient.doList(VOLUME_ACTIVATE_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VolumeActivateInputCollection) Next() (*VolumeActivateInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VolumeActivateInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VolumeActivateInputClient) ById(id string) (*VolumeActivateInput, error) { + resp := &VolumeActivateInput{} + err := c.rancherClient.doById(VOLUME_ACTIVATE_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *VolumeActivateInputClient) Delete(container *VolumeActivateInput) error { + return c.rancherClient.doResourceDelete(VOLUME_ACTIVATE_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_volume_snapshot_input.go b/vendor/github.com/rancher/go-rancher/v2/generated_volume_snapshot_input.go new file mode 100644 index 0000000000..2e2425a262 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_volume_snapshot_input.go @@ -0,0 +1,79 @@ +package client + +const ( + VOLUME_SNAPSHOT_INPUT_TYPE = "volumeSnapshotInput" +) + +type VolumeSnapshotInput struct { + Resource + + Name string `json:"name,omitempty" yaml:"name,omitempty"` +} + +type VolumeSnapshotInputCollection struct { + Collection + Data []VolumeSnapshotInput `json:"data,omitempty"` + client *VolumeSnapshotInputClient +} + +type VolumeSnapshotInputClient struct { + rancherClient *RancherClient +} + +type VolumeSnapshotInputOperations interface { + List(opts *ListOpts) (*VolumeSnapshotInputCollection, error) + Create(opts *VolumeSnapshotInput) (*VolumeSnapshotInput, error) + Update(existing *VolumeSnapshotInput, updates interface{}) (*VolumeSnapshotInput, error) + ById(id string) (*VolumeSnapshotInput, error) + Delete(container *VolumeSnapshotInput) error +} + +func newVolumeSnapshotInputClient(rancherClient *RancherClient) *VolumeSnapshotInputClient { + return &VolumeSnapshotInputClient{ + rancherClient: rancherClient, + } +} + +func (c *VolumeSnapshotInputClient) Create(container *VolumeSnapshotInput) (*VolumeSnapshotInput, error) { + resp := &VolumeSnapshotInput{} + err := c.rancherClient.doCreate(VOLUME_SNAPSHOT_INPUT_TYPE, container, resp) + return resp, err +} + +func (c *VolumeSnapshotInputClient) Update(existing *VolumeSnapshotInput, updates interface{}) (*VolumeSnapshotInput, error) { + resp := &VolumeSnapshotInput{} + err := c.rancherClient.doUpdate(VOLUME_SNAPSHOT_INPUT_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VolumeSnapshotInputClient) List(opts *ListOpts) (*VolumeSnapshotInputCollection, error) { + resp := &VolumeSnapshotInputCollection{} + err := c.rancherClient.doList(VOLUME_SNAPSHOT_INPUT_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VolumeSnapshotInputCollection) Next() (*VolumeSnapshotInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VolumeSnapshotInputCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VolumeSnapshotInputClient) ById(id string) (*VolumeSnapshotInput, error) { + resp := &VolumeSnapshotInput{} + err := c.rancherClient.doById(VOLUME_SNAPSHOT_INPUT_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *VolumeSnapshotInputClient) Delete(container *VolumeSnapshotInput) error { + return c.rancherClient.doResourceDelete(VOLUME_SNAPSHOT_INPUT_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/v2/generated_volume_template.go b/vendor/github.com/rancher/go-rancher/v2/generated_volume_template.go new file mode 100644 index 0000000000..a7479127fb --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/generated_volume_template.go @@ -0,0 +1,179 @@ +package client + +const ( + VOLUME_TEMPLATE_TYPE = "volumeTemplate" +) + +type VolumeTemplate struct { + Resource + + AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` + + Created string `json:"created,omitempty" yaml:"created,omitempty"` + + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + + DriverOpts map[string]interface{} `json:"driverOpts,omitempty" yaml:"driver_opts,omitempty"` + + External bool `json:"external,omitempty" yaml:"external,omitempty"` + + Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + PerContainer bool `json:"perContainer,omitempty" yaml:"per_container,omitempty"` + + RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"` + + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + + StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"` + + State string `json:"state,omitempty" yaml:"state,omitempty"` + + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` + + TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` + + Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type VolumeTemplateCollection struct { + Collection + Data []VolumeTemplate `json:"data,omitempty"` + client *VolumeTemplateClient +} + +type VolumeTemplateClient struct { + rancherClient *RancherClient +} + +type VolumeTemplateOperations interface { + List(opts *ListOpts) (*VolumeTemplateCollection, error) + Create(opts *VolumeTemplate) (*VolumeTemplate, error) + Update(existing *VolumeTemplate, updates interface{}) (*VolumeTemplate, error) + ById(id string) (*VolumeTemplate, error) + Delete(container *VolumeTemplate) error + + ActionActivate(*VolumeTemplate) (*VolumeTemplate, error) + + ActionCreate(*VolumeTemplate) (*VolumeTemplate, error) + + ActionDeactivate(*VolumeTemplate) (*VolumeTemplate, error) + + ActionPurge(*VolumeTemplate) (*VolumeTemplate, error) + + ActionRemove(*VolumeTemplate) (*VolumeTemplate, error) + + ActionUpdate(*VolumeTemplate) (*VolumeTemplate, error) +} + +func newVolumeTemplateClient(rancherClient *RancherClient) *VolumeTemplateClient { + return &VolumeTemplateClient{ + rancherClient: rancherClient, + } +} + +func (c *VolumeTemplateClient) Create(container *VolumeTemplate) (*VolumeTemplate, error) { + resp := &VolumeTemplate{} + err := c.rancherClient.doCreate(VOLUME_TEMPLATE_TYPE, container, resp) + return resp, err +} + +func (c *VolumeTemplateClient) Update(existing *VolumeTemplate, updates interface{}) (*VolumeTemplate, error) { + resp := &VolumeTemplate{} + err := c.rancherClient.doUpdate(VOLUME_TEMPLATE_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VolumeTemplateClient) List(opts *ListOpts) (*VolumeTemplateCollection, error) { + resp := &VolumeTemplateCollection{} + err := c.rancherClient.doList(VOLUME_TEMPLATE_TYPE, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VolumeTemplateCollection) Next() (*VolumeTemplateCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VolumeTemplateCollection{} + err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VolumeTemplateClient) ById(id string) (*VolumeTemplate, error) { + resp := &VolumeTemplate{} + err := c.rancherClient.doById(VOLUME_TEMPLATE_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *VolumeTemplateClient) Delete(container *VolumeTemplate) error { + return c.rancherClient.doResourceDelete(VOLUME_TEMPLATE_TYPE, &container.Resource) +} + +func (c *VolumeTemplateClient) ActionActivate(resource *VolumeTemplate) (*VolumeTemplate, error) { + + resp := &VolumeTemplate{} + + err := c.rancherClient.doAction(VOLUME_TEMPLATE_TYPE, "activate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeTemplateClient) ActionCreate(resource *VolumeTemplate) (*VolumeTemplate, error) { + + resp := &VolumeTemplate{} + + err := c.rancherClient.doAction(VOLUME_TEMPLATE_TYPE, "create", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeTemplateClient) ActionDeactivate(resource *VolumeTemplate) (*VolumeTemplate, error) { + + resp := &VolumeTemplate{} + + err := c.rancherClient.doAction(VOLUME_TEMPLATE_TYPE, "deactivate", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeTemplateClient) ActionPurge(resource *VolumeTemplate) (*VolumeTemplate, error) { + + resp := &VolumeTemplate{} + + err := c.rancherClient.doAction(VOLUME_TEMPLATE_TYPE, "purge", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeTemplateClient) ActionRemove(resource *VolumeTemplate) (*VolumeTemplate, error) { + + resp := &VolumeTemplate{} + + err := c.rancherClient.doAction(VOLUME_TEMPLATE_TYPE, "remove", &resource.Resource, nil, resp) + + return resp, err +} + +func (c *VolumeTemplateClient) ActionUpdate(resource *VolumeTemplate) (*VolumeTemplate, error) { + + resp := &VolumeTemplate{} + + err := c.rancherClient.doAction(VOLUME_TEMPLATE_TYPE, "update", &resource.Resource, nil, resp) + + return resp, err +} diff --git a/vendor/github.com/rancher/go-rancher/v2/schemas.go b/vendor/github.com/rancher/go-rancher/v2/schemas.go new file mode 100644 index 0000000000..bcb6a7ec5b --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/schemas.go @@ -0,0 +1,131 @@ +package client + +import ( + "reflect" + "strings" +) + +type Schemas struct { + Collection + Data []Schema `json:"data,omitempty"` + schemasByName map[string]*Schema +} + +func (s *Schema) CheckField(name string) (Field, bool) { + for fieldName := range s.ResourceFields { + if fieldName == name { + v, ok := s.ResourceFields[fieldName] + return v, ok + } + } + return Field{}, false +} + +func (s *Schema) Field(name string) Field { + f, _ := s.CheckField(name) + return f +} + +func (s *Schemas) CheckSchema(name string) (Schema, bool) { + for i := range s.Data { + if s.Data[i].Id == name { + return s.Data[i], true + } + } + return Schema{}, false +} + +func (s *Schemas) Schema(name string) Schema { + r, _ := s.CheckSchema(name) + return r +} + +func typeToFields(t reflect.Type) map[string]Field { + result := map[string]Field{} + + for i := 0; i < t.NumField(); i++ { + schemaField := Field{} + + typeField := t.Field(i) + if typeField.Anonymous && typeField.Type.Kind() == reflect.Struct { + parentFields := typeToFields(typeField.Type) + for k, v := range result { + parentFields[k] = v + } + result = parentFields + continue + } else if typeField.Anonymous { + continue + } else if privateFieldRegex.FindStringIndex(typeField.Name) != nil { + continue + } + + fieldString := strings.ToLower(typeField.Type.Kind().String()) + + switch { + case strings.HasPrefix(fieldString, "int") || strings.HasPrefix(fieldString, "uint"): + schemaField.Type = "int" + case fieldString == "bool": + schemaField.Type = fieldString + case fieldString == "float32" || fieldString == "float64": + schemaField.Type = "float" + case fieldString == "string": + schemaField.Type = "string" + case fieldString == "map": + // HACK + schemaField.Type = "map[string]" + case fieldString == "slice": + // HACK + schemaField.Type = "array[string]" + } + + name := strings.Split(typeField.Tag.Get("json"), ",")[0] + if name == "" && len(typeField.Name) > 1 { + name = strings.ToLower(typeField.Name[0:1]) + typeField.Name[1:] + } else if name == "" { + name = typeField.Name + } + + if schemaField.Type != "" { + result[name] = schemaField + } + } + + return result +} + +func (s *Schemas) AddType(schemaName string, obj interface{}) *Schema { + t := reflect.TypeOf(obj) + schema := Schema{ + Resource: Resource{ + Id: schemaName, + Type: "schema", + Links: map[string]string{}, + }, + PluralName: guessPluralName(schemaName), + ResourceFields: typeToFields(t), + CollectionMethods: []string{"GET"}, + ResourceMethods: []string{"GET"}, + } + + if s.Data == nil { + s.Data = []Schema{} + } + + s.Data = append(s.Data, schema) + + return &s.Data[len(s.Data)-1] +} + +func guessPluralName(name string) string { + if name == "" { + return "" + } + + if strings.HasSuffix(name, "s") || + strings.HasSuffix(name, "ch") || + strings.HasSuffix(name, "x") { + return name + "es" + } + return name + "s" +} diff --git a/vendor/github.com/rancher/go-rancher/v2/types.go b/vendor/github.com/rancher/go-rancher/v2/types.go new file mode 100644 index 0000000000..905df87ffa --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/v2/types.go @@ -0,0 +1,95 @@ +package client + +type Collection struct { + Type string `json:"type,omitempty"` + ResourceType string `json:"resourceType,omitempty"` + Links map[string]string `json:"links,omitempty"` + CreateTypes map[string]string `json:"createTypes,omitempty"` + Actions map[string]string `json:"actions,omitempty"` + SortLinks map[string]string `json:"sortLinks,omitempty"` + Pagination *Pagination `json:"pagination,omitempty"` + Sort *Sort `json:"sort,omitempty"` + Filters map[string][]Condition `json:"filters,omitempty"` +} + +type GenericCollection struct { + Collection + Data []interface{} `json:"data,omitempty"` +} + +type ResourceCollection struct { + Collection + Data []Resource `json:"data,omitempty"` +} + +type Sort struct { + Name string `json:"name,omitempty"` + Order string `json:"order,omitempty"` + Reverse string `json:"reverse,omitempty"` +} + +type Condition struct { + Modifier string `json:"modifier,omitempty"` + Value interface{} `json:"value,omitempty"` +} + +type Pagination struct { + Marker string `json:"marker,omitempty"` + First string `json:"first,omitempty"` + Previous string `json:"previous,omitempty"` + Next string `json:"next,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Total *int64 `json:"total,omitempty"` + Partial bool `json:"partial,omitempty"` +} + +type Resource struct { + Id string `json:"id,omitempty"` + Type string `json:"type,omitempty"` + Links map[string]string `json:"links"` + Actions map[string]string `json:"actions"` +} + +type Schema struct { + Resource + PluralName string `json:"pluralName,omitempty"` + ResourceMethods []string `json:"resourceMethods,omitempty"` + ResourceFields map[string]Field `json:"resourceFields,omitempty"` + ResourceActions map[string]Action `json:"resourceActions,omitempty"` + CollectionMethods []string `json:"collectionMethods,omitempty"` + CollectionFields map[string]Field `json:"collectionFields,omitempty"` + CollectionActions map[string]Action `json:"collectionActions,omitempty"` + CollectionFilters map[string]Filter `json:"collectionFilters,omitempty"` + IncludeableLinks []string `json:"includeableLinks,omitempty"` +} + +type Field struct { + Type string `json:"type,omitempty"` + Default interface{} `json:"default,omitempty"` + Unique bool `json:"unique,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Create bool `json:"create,omitempty"` + Required bool `json:"required,omitempty"` + Update bool `json:"update,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + Min *int64 `json:"min,omitempty"` + Max *int64 `json:"max,omitempty"` + Options []string `json:"options,omitempty"` + ValidChars string `json:"validChars,omitempty"` + InvalidChars string `json:"invalidChars,omitempty"` + Description string `json:"description,omitempty"` +} + +type Action struct { + Input string `json:"input,omitempty"` + Output string `json:"output,omitempty"` +} + +type Filter struct { + Modifiers []string `json:"modifiers,omitempty"` +} + +type ListOpts struct { + Filters map[string]interface{} +} diff --git a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset.go b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset.go index 054d058c85..cb192d59a8 100644 --- a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset.go +++ b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset.go @@ -2,17 +2,24 @@ package apply import ( "context" + "errors" + "fmt" "github.com/rancher/wrangler/pkg/apply/injectors" "github.com/rancher/wrangler/pkg/kv" "github.com/rancher/wrangler/pkg/merr" "github.com/rancher/wrangler/pkg/objectset" + "github.com/sirupsen/logrus" + "k8s.io/apimachinery/pkg/api/meta" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/tools/cache" ) +// Indexer name added for cached types +const byHash = "wrangler.byObjectSetHash" + type patchKey struct { schema.GroupVersionKind objectset.ObjectKey @@ -160,13 +167,40 @@ func (o desiredSet) WithCacheTypes(igs ...InformerGetter) Apply { } for _, ig := range igs { - pruneTypes[ig.GroupVersionKind()] = ig.Informer() + informer := ig.Informer() + if err := addIndexerByHash(informer.GetIndexer()); err != nil { + // Ignore repeatedly adding the same indexer for different types + if !errors.Is(err, indexerAlreadyExistsErr) { + logrus.Warnf("Problem adding hash indexer to informer [%s]: %v", ig.GroupVersionKind().Kind, err) + } + } + pruneTypes[ig.GroupVersionKind()] = informer } o.pruneTypes = pruneTypes return o } +// addIndexerByHash an Informer to index objects by the hash annotation value +func addIndexerByHash(indexer cache.Indexer) error { + if _, alreadyAdded := indexer.GetIndexers()[byHash]; alreadyAdded { + return fmt.Errorf("adding indexer %q: %w", byHash, indexerAlreadyExistsErr) + } + return indexer.AddIndexers(map[string]cache.IndexFunc{ + byHash: func(obj interface{}) ([]string, error) { + metadata, err := meta.Accessor(obj) + if err != nil { + return nil, err + } + labels := metadata.GetLabels() + if labels == nil || labels[LabelHash] == "" { + return nil, nil + } + return []string{labels[LabelHash]}, nil + }, + }) +} + func (o desiredSet) WithPatcher(gvk schema.GroupVersionKind, patcher Patcher) Apply { patchers := map[schema.GroupVersionKind]Patcher{} for k, v := range o.patchers { diff --git a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go index cf4ee23280..cb68e4e8ea 100644 --- a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go +++ b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go @@ -40,8 +40,9 @@ var ( LabelName, LabelNamespace, } - rls = map[string]flowcontrol.RateLimiter{} - rlsLock sync.Mutex + rls = map[string]flowcontrol.RateLimiter{} + rlsLock sync.Mutex + indexerAlreadyExistsErr = errors.New("an indexer with the same already exists") ) func (o *desiredSet) getRateLimit(labelHash string) flowcontrol.RateLimiter { diff --git a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go index e24c8d59a9..84710113bc 100644 --- a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go +++ b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go @@ -338,8 +338,7 @@ func (o *desiredSet) process(debugID string, set labels.Selector, gvk schema.Gro } } -func (o *desiredSet) list(namespaced bool, informer cache.SharedIndexInformer, client dynamic.NamespaceableResourceInterface, - selector labels.Selector, desiredObjects objectset.ObjectByKey) (map[objectset.ObjectKey]runtime.Object, error) { +func (o *desiredSet) list(namespaced bool, informer cache.SharedIndexInformer, client dynamic.NamespaceableResourceInterface, selector labels.Selector, desiredObjects objectset.ObjectByKey) (map[objectset.ObjectKey]runtime.Object, error) { var ( errs []error objs = objectset.ObjectByKey{} @@ -388,12 +387,17 @@ func (o *desiredSet) list(namespaced bool, informer cache.SharedIndexInformer, c namespace = o.listerNamespace } - err := cache.ListAllByNamespace(informer.GetIndexer(), namespace, selector, func(obj interface{}) { + // Special case for listing only by hash using indexers + indexer := informer.GetIndexer() + if hash, ok := getIndexableHash(indexer, selector); ok { + return listByHash(indexer, hash, namespace) + } + + if err := cache.ListAllByNamespace(indexer, namespace, selector, func(obj interface{}) { if err := addObjectToMap(objs, obj); err != nil { errs = append(errs, err) } - }) - if err != nil { + }); err != nil { errs = append(errs, err) } @@ -494,3 +498,45 @@ func multiNamespaceList(ctx context.Context, namespaces []string, baseClient dyn return wg.Wait() } + +// getIndexableHash detects if provided selector can be replaced by using the hash index, if configured, in which case returns the hash value +func getIndexableHash(indexer cache.Indexer, selector labels.Selector) (string, bool) { + // Check if indexer was added + if indexer == nil || indexer.GetIndexers()[byHash] == nil { + return "", false + } + + // Check specific case of listing with exact hash label selector + if req, selectable := selector.Requirements(); len(req) != 1 || !selectable { + return "", false + } + + return selector.RequiresExactMatch(LabelHash) +} + +// inNamespace checks whether a given object is a Kubernetes object and is part of the provided namespace +func inNamespace(namespace string, obj interface{}) bool { + metadata, err := meta.Accessor(obj) + return err == nil && metadata.GetNamespace() == namespace +} + +// listByHash use a pre-configured indexer to list objects of a certain type by their hash label +func listByHash(indexer cache.Indexer, hash string, namespace string) (map[objectset.ObjectKey]runtime.Object, error) { + var ( + errs []error + objs = objectset.ObjectByKey{} + ) + res, err := indexer.ByIndex(byHash, hash) + if err != nil { + return nil, err + } + for _, obj := range res { + if namespace != "" && !inNamespace(namespace, obj) { + continue + } + if err := addObjectToMap(objs, obj); err != nil { + errs = append(errs, err) + } + } + return objs, merr.NewErrors(errs...) +} diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1/customresourcedefinition.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1/customresourcedefinition.go index be7526f8ae..1d57b7c1b3 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1/customresourcedefinition.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1/customresourcedefinition.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *customResourceDefinitionCache) GetByIndex(indexName, key string) (resul return result, nil } +// CustomResourceDefinitionStatusHandler is executed for every added or modified CustomResourceDefinition. Should return the new status to be updated type CustomResourceDefinitionStatusHandler func(obj *v1.CustomResourceDefinition, status v1.CustomResourceDefinitionStatus) (v1.CustomResourceDefinitionStatus, error) +// CustomResourceDefinitionGeneratingHandler is the top-level handler that is executed for every CustomResourceDefinition event. It extends CustomResourceDefinitionStatusHandler by a returning a slice of child objects to be passed to apply.Apply type CustomResourceDefinitionGeneratingHandler func(obj *v1.CustomResourceDefinition, status v1.CustomResourceDefinitionStatus) ([]runtime.Object, v1.CustomResourceDefinitionStatus, error) +// RegisterCustomResourceDefinitionStatusHandler configures a CustomResourceDefinitionController to execute a CustomResourceDefinitionStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterCustomResourceDefinitionStatusHandler(ctx context.Context, controller CustomResourceDefinitionController, condition condition.Cond, name string, handler CustomResourceDefinitionStatusHandler) { statusHandler := &customResourceDefinitionStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterCustomResourceDefinitionStatusHandler(ctx context.Context, controll controller.AddGenericHandler(ctx, name, FromCustomResourceDefinitionHandlerToHandler(statusHandler.sync)) } +// RegisterCustomResourceDefinitionGeneratingHandler configures a CustomResourceDefinitionController to execute a CustomResourceDefinitionGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterCustomResourceDefinitionGeneratingHandler(ctx context.Context, controller CustomResourceDefinitionController, apply apply.Apply, condition condition.Cond, name string, handler CustomResourceDefinitionGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &customResourceDefinitionGeneratingHandler{ @@ -297,6 +304,7 @@ type customResourceDefinitionStatusHandler struct { handler CustomResourceDefinitionStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *customResourceDefinitionStatusHandler) sync(key string, obj *v1.CustomResourceDefinition) (*v1.CustomResourceDefinition, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type customResourceDefinitionGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *customResourceDefinitionGeneratingHandler) Remove(key string, obj *v1.CustomResourceDefinition) (*v1.CustomResourceDefinition, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *customResourceDefinitionGeneratingHandler) Remove(key string, obj *v1.C obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured CustomResourceDefinitionGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *customResourceDefinitionGeneratingHandler) Handle(obj *v1.CustomResourceDefinition, status v1.CustomResourceDefinitionStatus) (v1.CustomResourceDefinitionStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *customResourceDefinitionGeneratingHandler) Handle(obj *v1.CustomResourc if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *customResourceDefinitionGeneratingHandler) isNewResourceVersion(obj *v1.CustomResourceDefinition) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *customResourceDefinitionGeneratingHandler) storeResourceVersion(obj *v1.CustomResourceDefinition) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiregistration.k8s.io/v1/apiservice.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiregistration.k8s.io/v1/apiservice.go index 35dbaa1bfc..eda87f4872 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiregistration.k8s.io/v1/apiservice.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiregistration.k8s.io/v1/apiservice.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *aPIServiceCache) GetByIndex(indexName, key string) (result []*v1.APISer return result, nil } +// APIServiceStatusHandler is executed for every added or modified APIService. Should return the new status to be updated type APIServiceStatusHandler func(obj *v1.APIService, status v1.APIServiceStatus) (v1.APIServiceStatus, error) +// APIServiceGeneratingHandler is the top-level handler that is executed for every APIService event. It extends APIServiceStatusHandler by a returning a slice of child objects to be passed to apply.Apply type APIServiceGeneratingHandler func(obj *v1.APIService, status v1.APIServiceStatus) ([]runtime.Object, v1.APIServiceStatus, error) +// RegisterAPIServiceStatusHandler configures a APIServiceController to execute a APIServiceStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterAPIServiceStatusHandler(ctx context.Context, controller APIServiceController, condition condition.Cond, name string, handler APIServiceStatusHandler) { statusHandler := &aPIServiceStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterAPIServiceStatusHandler(ctx context.Context, controller APIServiceC controller.AddGenericHandler(ctx, name, FromAPIServiceHandlerToHandler(statusHandler.sync)) } +// RegisterAPIServiceGeneratingHandler configures a APIServiceController to execute a APIServiceGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterAPIServiceGeneratingHandler(ctx context.Context, controller APIServiceController, apply apply.Apply, condition condition.Cond, name string, handler APIServiceGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &aPIServiceGeneratingHandler{ @@ -297,6 +304,7 @@ type aPIServiceStatusHandler struct { handler APIServiceStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *aPIServiceStatusHandler) sync(key string, obj *v1.APIService) (*v1.APIService, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type aPIServiceGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *aPIServiceGeneratingHandler) Remove(key string, obj *v1.APIService) (*v1.APIService, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *aPIServiceGeneratingHandler) Remove(key string, obj *v1.APIService) (*v obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured APIServiceGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *aPIServiceGeneratingHandler) Handle(obj *v1.APIService, status v1.APIServiceStatus) (v1.APIServiceStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *aPIServiceGeneratingHandler) Handle(obj *v1.APIService, status v1.APISe if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *aPIServiceGeneratingHandler) isNewResourceVersion(obj *v1.APIService) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *aPIServiceGeneratingHandler) storeResourceVersion(obj *v1.APIService) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/daemonset.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/daemonset.go index 039d680dd9..2eb133d41a 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/daemonset.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/daemonset.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *daemonSetCache) GetByIndex(indexName, key string) (result []*v1.DaemonS return result, nil } +// DaemonSetStatusHandler is executed for every added or modified DaemonSet. Should return the new status to be updated type DaemonSetStatusHandler func(obj *v1.DaemonSet, status v1.DaemonSetStatus) (v1.DaemonSetStatus, error) +// DaemonSetGeneratingHandler is the top-level handler that is executed for every DaemonSet event. It extends DaemonSetStatusHandler by a returning a slice of child objects to be passed to apply.Apply type DaemonSetGeneratingHandler func(obj *v1.DaemonSet, status v1.DaemonSetStatus) ([]runtime.Object, v1.DaemonSetStatus, error) +// RegisterDaemonSetStatusHandler configures a DaemonSetController to execute a DaemonSetStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterDaemonSetStatusHandler(ctx context.Context, controller DaemonSetController, condition condition.Cond, name string, handler DaemonSetStatusHandler) { statusHandler := &daemonSetStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterDaemonSetStatusHandler(ctx context.Context, controller DaemonSetCon controller.AddGenericHandler(ctx, name, FromDaemonSetHandlerToHandler(statusHandler.sync)) } +// RegisterDaemonSetGeneratingHandler configures a DaemonSetController to execute a DaemonSetGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterDaemonSetGeneratingHandler(ctx context.Context, controller DaemonSetController, apply apply.Apply, condition condition.Cond, name string, handler DaemonSetGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &daemonSetGeneratingHandler{ @@ -297,6 +304,7 @@ type daemonSetStatusHandler struct { handler DaemonSetStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *daemonSetStatusHandler) sync(key string, obj *v1.DaemonSet) (*v1.DaemonSet, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type daemonSetGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *daemonSetGeneratingHandler) Remove(key string, obj *v1.DaemonSet) (*v1.DaemonSet, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *daemonSetGeneratingHandler) Remove(key string, obj *v1.DaemonSet) (*v1. obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured DaemonSetGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *daemonSetGeneratingHandler) Handle(obj *v1.DaemonSet, status v1.DaemonSetStatus) (v1.DaemonSetStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *daemonSetGeneratingHandler) Handle(obj *v1.DaemonSet, status v1.DaemonS if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *daemonSetGeneratingHandler) isNewResourceVersion(obj *v1.DaemonSet) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *daemonSetGeneratingHandler) storeResourceVersion(obj *v1.DaemonSet) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/deployment.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/deployment.go index 2adb321e99..c067aa5ba6 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/deployment.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/deployment.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *deploymentCache) GetByIndex(indexName, key string) (result []*v1.Deploy return result, nil } +// DeploymentStatusHandler is executed for every added or modified Deployment. Should return the new status to be updated type DeploymentStatusHandler func(obj *v1.Deployment, status v1.DeploymentStatus) (v1.DeploymentStatus, error) +// DeploymentGeneratingHandler is the top-level handler that is executed for every Deployment event. It extends DeploymentStatusHandler by a returning a slice of child objects to be passed to apply.Apply type DeploymentGeneratingHandler func(obj *v1.Deployment, status v1.DeploymentStatus) ([]runtime.Object, v1.DeploymentStatus, error) +// RegisterDeploymentStatusHandler configures a DeploymentController to execute a DeploymentStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterDeploymentStatusHandler(ctx context.Context, controller DeploymentController, condition condition.Cond, name string, handler DeploymentStatusHandler) { statusHandler := &deploymentStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterDeploymentStatusHandler(ctx context.Context, controller DeploymentC controller.AddGenericHandler(ctx, name, FromDeploymentHandlerToHandler(statusHandler.sync)) } +// RegisterDeploymentGeneratingHandler configures a DeploymentController to execute a DeploymentGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterDeploymentGeneratingHandler(ctx context.Context, controller DeploymentController, apply apply.Apply, condition condition.Cond, name string, handler DeploymentGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &deploymentGeneratingHandler{ @@ -297,6 +304,7 @@ type deploymentStatusHandler struct { handler DeploymentStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *deploymentStatusHandler) sync(key string, obj *v1.Deployment) (*v1.Deployment, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type deploymentGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *deploymentGeneratingHandler) Remove(key string, obj *v1.Deployment) (*v1.Deployment, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *deploymentGeneratingHandler) Remove(key string, obj *v1.Deployment) (*v obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured DeploymentGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *deploymentGeneratingHandler) Handle(obj *v1.Deployment, status v1.DeploymentStatus) (v1.DeploymentStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *deploymentGeneratingHandler) Handle(obj *v1.Deployment, status v1.Deplo if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *deploymentGeneratingHandler) isNewResourceVersion(obj *v1.Deployment) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *deploymentGeneratingHandler) storeResourceVersion(obj *v1.Deployment) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/statefulset.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/statefulset.go index a573f7c541..04a055aa1c 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/statefulset.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apps/v1/statefulset.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *statefulSetCache) GetByIndex(indexName, key string) (result []*v1.State return result, nil } +// StatefulSetStatusHandler is executed for every added or modified StatefulSet. Should return the new status to be updated type StatefulSetStatusHandler func(obj *v1.StatefulSet, status v1.StatefulSetStatus) (v1.StatefulSetStatus, error) +// StatefulSetGeneratingHandler is the top-level handler that is executed for every StatefulSet event. It extends StatefulSetStatusHandler by a returning a slice of child objects to be passed to apply.Apply type StatefulSetGeneratingHandler func(obj *v1.StatefulSet, status v1.StatefulSetStatus) ([]runtime.Object, v1.StatefulSetStatus, error) +// RegisterStatefulSetStatusHandler configures a StatefulSetController to execute a StatefulSetStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterStatefulSetStatusHandler(ctx context.Context, controller StatefulSetController, condition condition.Cond, name string, handler StatefulSetStatusHandler) { statusHandler := &statefulSetStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterStatefulSetStatusHandler(ctx context.Context, controller StatefulSe controller.AddGenericHandler(ctx, name, FromStatefulSetHandlerToHandler(statusHandler.sync)) } +// RegisterStatefulSetGeneratingHandler configures a StatefulSetController to execute a StatefulSetGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterStatefulSetGeneratingHandler(ctx context.Context, controller StatefulSetController, apply apply.Apply, condition condition.Cond, name string, handler StatefulSetGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &statefulSetGeneratingHandler{ @@ -297,6 +304,7 @@ type statefulSetStatusHandler struct { handler StatefulSetStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *statefulSetStatusHandler) sync(key string, obj *v1.StatefulSet) (*v1.StatefulSet, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type statefulSetGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *statefulSetGeneratingHandler) Remove(key string, obj *v1.StatefulSet) (*v1.StatefulSet, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *statefulSetGeneratingHandler) Remove(key string, obj *v1.StatefulSet) ( obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured StatefulSetGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *statefulSetGeneratingHandler) Handle(obj *v1.StatefulSet, status v1.StatefulSetStatus) (v1.StatefulSetStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *statefulSetGeneratingHandler) Handle(obj *v1.StatefulSet, status v1.Sta if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *statefulSetGeneratingHandler) isNewResourceVersion(obj *v1.StatefulSet) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *statefulSetGeneratingHandler) storeResourceVersion(obj *v1.StatefulSet) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go index ca5b9355f7..c97e79d48f 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *jobCache) GetByIndex(indexName, key string) (result []*v1.Job, err erro return result, nil } +// JobStatusHandler is executed for every added or modified Job. Should return the new status to be updated type JobStatusHandler func(obj *v1.Job, status v1.JobStatus) (v1.JobStatus, error) +// JobGeneratingHandler is the top-level handler that is executed for every Job event. It extends JobStatusHandler by a returning a slice of child objects to be passed to apply.Apply type JobGeneratingHandler func(obj *v1.Job, status v1.JobStatus) ([]runtime.Object, v1.JobStatus, error) +// RegisterJobStatusHandler configures a JobController to execute a JobStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterJobStatusHandler(ctx context.Context, controller JobController, condition condition.Cond, name string, handler JobStatusHandler) { statusHandler := &jobStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterJobStatusHandler(ctx context.Context, controller JobController, con controller.AddGenericHandler(ctx, name, FromJobHandlerToHandler(statusHandler.sync)) } +// RegisterJobGeneratingHandler configures a JobController to execute a JobGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterJobGeneratingHandler(ctx context.Context, controller JobController, apply apply.Apply, condition condition.Cond, name string, handler JobGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &jobGeneratingHandler{ @@ -297,6 +304,7 @@ type jobStatusHandler struct { handler JobStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *jobStatusHandler) sync(key string, obj *v1.Job) (*v1.Job, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type jobGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *jobGeneratingHandler) Remove(key string, obj *v1.Job) (*v1.Job, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *jobGeneratingHandler) Remove(key string, obj *v1.Job) (*v1.Job, error) obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured JobGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *jobGeneratingHandler) Handle(obj *v1.Job, status v1.JobStatus) (v1.JobStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *jobGeneratingHandler) Handle(obj *v1.Job, status v1.JobStatus) (v1.JobS if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *jobGeneratingHandler) isNewResourceVersion(obj *v1.Job) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *jobGeneratingHandler) storeResourceVersion(obj *v1.Job) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go index 83d04ac6b9..3f97d67557 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *namespaceCache) GetByIndex(indexName, key string) (result []*v1.Namespa return result, nil } +// NamespaceStatusHandler is executed for every added or modified Namespace. Should return the new status to be updated type NamespaceStatusHandler func(obj *v1.Namespace, status v1.NamespaceStatus) (v1.NamespaceStatus, error) +// NamespaceGeneratingHandler is the top-level handler that is executed for every Namespace event. It extends NamespaceStatusHandler by a returning a slice of child objects to be passed to apply.Apply type NamespaceGeneratingHandler func(obj *v1.Namespace, status v1.NamespaceStatus) ([]runtime.Object, v1.NamespaceStatus, error) +// RegisterNamespaceStatusHandler configures a NamespaceController to execute a NamespaceStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterNamespaceStatusHandler(ctx context.Context, controller NamespaceController, condition condition.Cond, name string, handler NamespaceStatusHandler) { statusHandler := &namespaceStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterNamespaceStatusHandler(ctx context.Context, controller NamespaceCon controller.AddGenericHandler(ctx, name, FromNamespaceHandlerToHandler(statusHandler.sync)) } +// RegisterNamespaceGeneratingHandler configures a NamespaceController to execute a NamespaceGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterNamespaceGeneratingHandler(ctx context.Context, controller NamespaceController, apply apply.Apply, condition condition.Cond, name string, handler NamespaceGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &namespaceGeneratingHandler{ @@ -297,6 +304,7 @@ type namespaceStatusHandler struct { handler NamespaceStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *namespaceStatusHandler) sync(key string, obj *v1.Namespace) (*v1.Namespace, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type namespaceGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *namespaceGeneratingHandler) Remove(key string, obj *v1.Namespace) (*v1.Namespace, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *namespaceGeneratingHandler) Remove(key string, obj *v1.Namespace) (*v1. obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured NamespaceGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *namespaceGeneratingHandler) Handle(obj *v1.Namespace, status v1.NamespaceStatus) (v1.NamespaceStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *namespaceGeneratingHandler) Handle(obj *v1.Namespace, status v1.Namespa if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *namespaceGeneratingHandler) isNewResourceVersion(obj *v1.Namespace) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *namespaceGeneratingHandler) storeResourceVersion(obj *v1.Namespace) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go index b444b33c3c..1bd956bfe8 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *nodeCache) GetByIndex(indexName, key string) (result []*v1.Node, err er return result, nil } +// NodeStatusHandler is executed for every added or modified Node. Should return the new status to be updated type NodeStatusHandler func(obj *v1.Node, status v1.NodeStatus) (v1.NodeStatus, error) +// NodeGeneratingHandler is the top-level handler that is executed for every Node event. It extends NodeStatusHandler by a returning a slice of child objects to be passed to apply.Apply type NodeGeneratingHandler func(obj *v1.Node, status v1.NodeStatus) ([]runtime.Object, v1.NodeStatus, error) +// RegisterNodeStatusHandler configures a NodeController to execute a NodeStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterNodeStatusHandler(ctx context.Context, controller NodeController, condition condition.Cond, name string, handler NodeStatusHandler) { statusHandler := &nodeStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterNodeStatusHandler(ctx context.Context, controller NodeController, c controller.AddGenericHandler(ctx, name, FromNodeHandlerToHandler(statusHandler.sync)) } +// RegisterNodeGeneratingHandler configures a NodeController to execute a NodeGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterNodeGeneratingHandler(ctx context.Context, controller NodeController, apply apply.Apply, condition condition.Cond, name string, handler NodeGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &nodeGeneratingHandler{ @@ -297,6 +304,7 @@ type nodeStatusHandler struct { handler NodeStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *nodeStatusHandler) sync(key string, obj *v1.Node) (*v1.Node, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type nodeGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *nodeGeneratingHandler) Remove(key string, obj *v1.Node) (*v1.Node, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *nodeGeneratingHandler) Remove(key string, obj *v1.Node) (*v1.Node, erro obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured NodeGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *nodeGeneratingHandler) Handle(obj *v1.Node, status v1.NodeStatus) (v1.NodeStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *nodeGeneratingHandler) Handle(obj *v1.Node, status v1.NodeStatus) (v1.N if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *nodeGeneratingHandler) isNewResourceVersion(obj *v1.Node) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *nodeGeneratingHandler) storeResourceVersion(obj *v1.Node) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolume.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolume.go index 576c5607f0..097e450e13 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolume.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolume.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *persistentVolumeCache) GetByIndex(indexName, key string) (result []*v1. return result, nil } +// PersistentVolumeStatusHandler is executed for every added or modified PersistentVolume. Should return the new status to be updated type PersistentVolumeStatusHandler func(obj *v1.PersistentVolume, status v1.PersistentVolumeStatus) (v1.PersistentVolumeStatus, error) +// PersistentVolumeGeneratingHandler is the top-level handler that is executed for every PersistentVolume event. It extends PersistentVolumeStatusHandler by a returning a slice of child objects to be passed to apply.Apply type PersistentVolumeGeneratingHandler func(obj *v1.PersistentVolume, status v1.PersistentVolumeStatus) ([]runtime.Object, v1.PersistentVolumeStatus, error) +// RegisterPersistentVolumeStatusHandler configures a PersistentVolumeController to execute a PersistentVolumeStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterPersistentVolumeStatusHandler(ctx context.Context, controller PersistentVolumeController, condition condition.Cond, name string, handler PersistentVolumeStatusHandler) { statusHandler := &persistentVolumeStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterPersistentVolumeStatusHandler(ctx context.Context, controller Persi controller.AddGenericHandler(ctx, name, FromPersistentVolumeHandlerToHandler(statusHandler.sync)) } +// RegisterPersistentVolumeGeneratingHandler configures a PersistentVolumeController to execute a PersistentVolumeGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterPersistentVolumeGeneratingHandler(ctx context.Context, controller PersistentVolumeController, apply apply.Apply, condition condition.Cond, name string, handler PersistentVolumeGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &persistentVolumeGeneratingHandler{ @@ -297,6 +304,7 @@ type persistentVolumeStatusHandler struct { handler PersistentVolumeStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *persistentVolumeStatusHandler) sync(key string, obj *v1.PersistentVolume) (*v1.PersistentVolume, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type persistentVolumeGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *persistentVolumeGeneratingHandler) Remove(key string, obj *v1.PersistentVolume) (*v1.PersistentVolume, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *persistentVolumeGeneratingHandler) Remove(key string, obj *v1.Persisten obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured PersistentVolumeGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *persistentVolumeGeneratingHandler) Handle(obj *v1.PersistentVolume, status v1.PersistentVolumeStatus) (v1.PersistentVolumeStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *persistentVolumeGeneratingHandler) Handle(obj *v1.PersistentVolume, sta if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *persistentVolumeGeneratingHandler) isNewResourceVersion(obj *v1.PersistentVolume) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *persistentVolumeGeneratingHandler) storeResourceVersion(obj *v1.PersistentVolume) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go index 5fbce6d885..8b23338f88 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *persistentVolumeClaimCache) GetByIndex(indexName, key string) (result [ return result, nil } +// PersistentVolumeClaimStatusHandler is executed for every added or modified PersistentVolumeClaim. Should return the new status to be updated type PersistentVolumeClaimStatusHandler func(obj *v1.PersistentVolumeClaim, status v1.PersistentVolumeClaimStatus) (v1.PersistentVolumeClaimStatus, error) +// PersistentVolumeClaimGeneratingHandler is the top-level handler that is executed for every PersistentVolumeClaim event. It extends PersistentVolumeClaimStatusHandler by a returning a slice of child objects to be passed to apply.Apply type PersistentVolumeClaimGeneratingHandler func(obj *v1.PersistentVolumeClaim, status v1.PersistentVolumeClaimStatus) ([]runtime.Object, v1.PersistentVolumeClaimStatus, error) +// RegisterPersistentVolumeClaimStatusHandler configures a PersistentVolumeClaimController to execute a PersistentVolumeClaimStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterPersistentVolumeClaimStatusHandler(ctx context.Context, controller PersistentVolumeClaimController, condition condition.Cond, name string, handler PersistentVolumeClaimStatusHandler) { statusHandler := &persistentVolumeClaimStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterPersistentVolumeClaimStatusHandler(ctx context.Context, controller controller.AddGenericHandler(ctx, name, FromPersistentVolumeClaimHandlerToHandler(statusHandler.sync)) } +// RegisterPersistentVolumeClaimGeneratingHandler configures a PersistentVolumeClaimController to execute a PersistentVolumeClaimGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterPersistentVolumeClaimGeneratingHandler(ctx context.Context, controller PersistentVolumeClaimController, apply apply.Apply, condition condition.Cond, name string, handler PersistentVolumeClaimGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &persistentVolumeClaimGeneratingHandler{ @@ -297,6 +304,7 @@ type persistentVolumeClaimStatusHandler struct { handler PersistentVolumeClaimStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *persistentVolumeClaimStatusHandler) sync(key string, obj *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type persistentVolumeClaimGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *persistentVolumeClaimGeneratingHandler) Remove(key string, obj *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *persistentVolumeClaimGeneratingHandler) Remove(key string, obj *v1.Pers obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured PersistentVolumeClaimGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *persistentVolumeClaimGeneratingHandler) Handle(obj *v1.PersistentVolumeClaim, status v1.PersistentVolumeClaimStatus) (v1.PersistentVolumeClaimStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *persistentVolumeClaimGeneratingHandler) Handle(obj *v1.PersistentVolume if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *persistentVolumeClaimGeneratingHandler) isNewResourceVersion(obj *v1.PersistentVolumeClaim) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *persistentVolumeClaimGeneratingHandler) storeResourceVersion(obj *v1.PersistentVolumeClaim) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go index 4286bcf56e..b52fe1c404 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *podCache) GetByIndex(indexName, key string) (result []*v1.Pod, err erro return result, nil } +// PodStatusHandler is executed for every added or modified Pod. Should return the new status to be updated type PodStatusHandler func(obj *v1.Pod, status v1.PodStatus) (v1.PodStatus, error) +// PodGeneratingHandler is the top-level handler that is executed for every Pod event. It extends PodStatusHandler by a returning a slice of child objects to be passed to apply.Apply type PodGeneratingHandler func(obj *v1.Pod, status v1.PodStatus) ([]runtime.Object, v1.PodStatus, error) +// RegisterPodStatusHandler configures a PodController to execute a PodStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterPodStatusHandler(ctx context.Context, controller PodController, condition condition.Cond, name string, handler PodStatusHandler) { statusHandler := &podStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterPodStatusHandler(ctx context.Context, controller PodController, con controller.AddGenericHandler(ctx, name, FromPodHandlerToHandler(statusHandler.sync)) } +// RegisterPodGeneratingHandler configures a PodController to execute a PodGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterPodGeneratingHandler(ctx context.Context, controller PodController, apply apply.Apply, condition condition.Cond, name string, handler PodGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &podGeneratingHandler{ @@ -297,6 +304,7 @@ type podStatusHandler struct { handler PodStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *podStatusHandler) sync(key string, obj *v1.Pod) (*v1.Pod, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type podGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *podGeneratingHandler) Remove(key string, obj *v1.Pod) (*v1.Pod, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *podGeneratingHandler) Remove(key string, obj *v1.Pod) (*v1.Pod, error) obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured PodGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *podGeneratingHandler) Handle(obj *v1.Pod, status v1.PodStatus) (v1.PodStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *podGeneratingHandler) Handle(obj *v1.Pod, status v1.PodStatus) (v1.PodS if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *podGeneratingHandler) isNewResourceVersion(obj *v1.Pod) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *podGeneratingHandler) storeResourceVersion(obj *v1.Pod) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go index 4802feb6ba..a347887c65 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go @@ -20,6 +20,7 @@ package v1 import ( "context" + "sync" "time" "github.com/rancher/lasso/pkg/client" @@ -263,10 +264,14 @@ func (c *serviceCache) GetByIndex(indexName, key string) (result []*v1.Service, return result, nil } +// ServiceStatusHandler is executed for every added or modified Service. Should return the new status to be updated type ServiceStatusHandler func(obj *v1.Service, status v1.ServiceStatus) (v1.ServiceStatus, error) +// ServiceGeneratingHandler is the top-level handler that is executed for every Service event. It extends ServiceStatusHandler by a returning a slice of child objects to be passed to apply.Apply type ServiceGeneratingHandler func(obj *v1.Service, status v1.ServiceStatus) ([]runtime.Object, v1.ServiceStatus, error) +// RegisterServiceStatusHandler configures a ServiceController to execute a ServiceStatusHandler for every events observed. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterServiceStatusHandler(ctx context.Context, controller ServiceController, condition condition.Cond, name string, handler ServiceStatusHandler) { statusHandler := &serviceStatusHandler{ client: controller, @@ -276,6 +281,8 @@ func RegisterServiceStatusHandler(ctx context.Context, controller ServiceControl controller.AddGenericHandler(ctx, name, FromServiceHandlerToHandler(statusHandler.sync)) } +// RegisterServiceGeneratingHandler configures a ServiceController to execute a ServiceGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. +// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution func RegisterServiceGeneratingHandler(ctx context.Context, controller ServiceController, apply apply.Apply, condition condition.Cond, name string, handler ServiceGeneratingHandler, opts *generic.GeneratingHandlerOptions) { statusHandler := &serviceGeneratingHandler{ @@ -297,6 +304,7 @@ type serviceStatusHandler struct { handler ServiceStatusHandler } +// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API func (a *serviceStatusHandler) sync(key string, obj *v1.Service) (*v1.Service, error) { if obj == nil { return obj, nil @@ -342,8 +350,10 @@ type serviceGeneratingHandler struct { opts generic.GeneratingHandlerOptions gvk schema.GroupVersionKind name string + seen sync.Map } +// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied func (a *serviceGeneratingHandler) Remove(key string, obj *v1.Service) (*v1.Service, error) { if obj != nil { return obj, nil @@ -353,12 +363,17 @@ func (a *serviceGeneratingHandler) Remove(key string, obj *v1.Service) (*v1.Serv obj.Namespace, obj.Name = kv.RSplit(key, "/") obj.SetGroupVersionKind(a.gvk) + if a.opts.UniqueApplyForResourceVersion { + a.seen.Delete(key) + } + return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects() } +// Handle executes the configured ServiceGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource func (a *serviceGeneratingHandler) Handle(obj *v1.Service, status v1.ServiceStatus) (v1.ServiceStatus, error) { if !obj.DeletionTimestamp.IsZero() { return status, nil @@ -368,9 +383,41 @@ func (a *serviceGeneratingHandler) Handle(obj *v1.Service, status v1.ServiceStat if err != nil { return newStatus, err } + if !a.isNewResourceVersion(obj) { + return newStatus, nil + } - return newStatus, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). + err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). WithOwner(obj). WithSetID(a.name). ApplyObjects(objs...) + if err != nil { + return newStatus, err + } + a.storeResourceVersion(obj) + return newStatus, nil +} + +// isNewResourceVersion detects if a specific resource version was already successfully processed. +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *serviceGeneratingHandler) isNewResourceVersion(obj *v1.Service) bool { + if !a.opts.UniqueApplyForResourceVersion { + return true + } + + // Apply once per resource version + key := obj.Namespace + "/" + obj.Name + previous, ok := a.seen.Load(key) + return !ok || previous != obj.ResourceVersion +} + +// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed +// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions +func (a *serviceGeneratingHandler) storeResourceVersion(obj *v1.Service) { + if !a.opts.UniqueApplyForResourceVersion { + return + } + + key := obj.Namespace + "/" + obj.Name + a.seen.Store(key, obj.ResourceVersion) } diff --git a/vendor/github.com/rancher/wrangler/pkg/generic/generating.go b/vendor/github.com/rancher/wrangler/pkg/generic/generating.go index 9ac9fae863..3063e47f09 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generic/generating.go +++ b/vendor/github.com/rancher/wrangler/pkg/generic/generating.go @@ -10,6 +10,8 @@ type GeneratingHandlerOptions struct { AllowClusterScoped bool NoOwnerReference bool DynamicLookup bool + // UniqueApplyForResourceVersion will skip calling apply if the resource version didn't change from the previous execution + UniqueApplyForResourceVersion bool } func ConfigureApplyForObject(apply apply.Apply, obj metav1.Object, opts *GeneratingHandlerOptions) apply.Apply { diff --git a/vendor/github.com/rancher/wrangler/pkg/signals/signal.go b/vendor/github.com/rancher/wrangler/pkg/signals/signal.go index ccbdabe759..724b9e1981 100644 --- a/vendor/github.com/rancher/wrangler/pkg/signals/signal.go +++ b/vendor/github.com/rancher/wrangler/pkg/signals/signal.go @@ -63,4 +63,4 @@ func RequestShutdown() bool { } return false -} \ No newline at end of file +} diff --git a/vendor/github.com/rancher/wrangler/pkg/signals/signal_posix.go b/vendor/github.com/rancher/wrangler/pkg/signals/signal_posix.go index 9bdb4e7418..a0f00a7321 100644 --- a/vendor/github.com/rancher/wrangler/pkg/signals/signal_posix.go +++ b/vendor/github.com/rancher/wrangler/pkg/signals/signal_posix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows /* diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go new file mode 100644 index 0000000000..a4d1919a9e --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go @@ -0,0 +1,76 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package terminal provides support functions for dealing with terminals, as +// commonly found on UNIX systems. +// +// Deprecated: this package moved to golang.org/x/term. +package terminal + +import ( + "io" + + "golang.org/x/term" +) + +// EscapeCodes contains escape sequences that can be written to the terminal in +// order to achieve different styles of text. +type EscapeCodes = term.EscapeCodes + +// Terminal contains the state for running a VT100 terminal that is capable of +// reading lines of input. +type Terminal = term.Terminal + +// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is +// a local terminal, that terminal must first have been put into raw mode. +// prompt is a string that is written at the start of each input line (i.e. +// "> "). +func NewTerminal(c io.ReadWriter, prompt string) *Terminal { + return term.NewTerminal(c, prompt) +} + +// ErrPasteIndicator may be returned from ReadLine as the error, in addition +// to valid line data. It indicates that bracketed paste mode is enabled and +// that the returned line consists only of pasted data. Programs may wish to +// interpret pasted data more literally than typed data. +var ErrPasteIndicator = term.ErrPasteIndicator + +// State contains the state of a terminal. +type State = term.State + +// IsTerminal returns whether the given file descriptor is a terminal. +func IsTerminal(fd int) bool { + return term.IsTerminal(fd) +} + +// ReadPassword reads a line of input from a terminal without local echo. This +// is commonly used for inputting passwords and other sensitive data. The slice +// returned does not include the \n. +func ReadPassword(fd int) ([]byte, error) { + return term.ReadPassword(fd) +} + +// MakeRaw puts the terminal connected to the given file descriptor into raw +// mode and returns the previous state of the terminal so that it can be +// restored. +func MakeRaw(fd int) (*State, error) { + return term.MakeRaw(fd) +} + +// Restore restores the terminal connected to the given file descriptor to a +// previous state. +func Restore(fd int, oldState *State) error { + return term.Restore(fd, oldState) +} + +// GetState returns the current state of a terminal which may be useful to +// restore the terminal after a signal. +func GetState(fd int) (*State, error) { + return term.GetState(fd) +} + +// GetSize returns the dimensions of the given terminal. +func GetSize(fd int) (width, height int, err error) { + return term.GetSize(fd) +} diff --git a/vendor/k8s.io/utils/integer/integer.go b/vendor/k8s.io/utils/integer/integer.go index e4e740cad4..e0811e8344 100644 --- a/vendor/k8s.io/utils/integer/integer.go +++ b/vendor/k8s.io/utils/integer/integer.go @@ -16,6 +16,8 @@ limitations under the License. package integer +import "math" + // IntMax returns the maximum of the params func IntMax(a, b int) int { if b > a { @@ -65,9 +67,7 @@ func Int64Min(a, b int64) int64 { } // RoundToInt32 rounds floats into integer numbers. +// Deprecated: use math.Round() and a cast directly. func RoundToInt32(a float64) int32 { - if a < 0 { - return int32(a - 0.5) - } - return int32(a + 0.5) + return int32(math.Round(a)) } diff --git a/vendor/k8s.io/utils/pointer/pointer.go b/vendor/k8s.io/utils/pointer/pointer.go index b8103223ad..b673a64257 100644 --- a/vendor/k8s.io/utils/pointer/pointer.go +++ b/vendor/k8s.io/utils/pointer/pointer.go @@ -14,12 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ +// Deprecated: Use functions in k8s.io/utils/ptr instead: ptr.To to obtain +// a pointer, ptr.Deref to dereference a pointer, ptr.Equal to compare +// dereferenced pointers. package pointer import ( - "fmt" - "reflect" "time" + + "k8s.io/utils/ptr" ) // AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when, @@ -28,383 +31,219 @@ import ( // // This function is only valid for structs and pointers to structs. Any other // type will cause a panic. Passing a typed nil pointer will return true. -func AllPtrFieldsNil(obj interface{}) bool { - v := reflect.ValueOf(obj) - if !v.IsValid() { - panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj)) - } - if v.Kind() == reflect.Ptr { - if v.IsNil() { - return true - } - v = v.Elem() - } - for i := 0; i < v.NumField(); i++ { - if v.Field(i).Kind() == reflect.Ptr && !v.Field(i).IsNil() { - return false - } - } - return true -} - -// Int returns a pointer to an int -func Int(i int) *int { - return &i -} +// +// Deprecated: Use ptr.AllPtrFieldsNil instead. +var AllPtrFieldsNil = ptr.AllPtrFieldsNil + +// Int returns a pointer to an int. +var Int = ptr.To[int] // IntPtr is a function variable referring to Int. // -// Deprecated: Use Int instead. +// Deprecated: Use ptr.To instead. var IntPtr = Int // for back-compat // IntDeref dereferences the int ptr and returns it if not nil, or else // returns def. -func IntDeref(ptr *int, def int) int { - if ptr != nil { - return *ptr - } - return def -} +var IntDeref = ptr.Deref[int] // IntPtrDerefOr is a function variable referring to IntDeref. // -// Deprecated: Use IntDeref instead. +// Deprecated: Use ptr.Deref instead. var IntPtrDerefOr = IntDeref // for back-compat // Int32 returns a pointer to an int32. -func Int32(i int32) *int32 { - return &i -} +var Int32 = ptr.To[int32] // Int32Ptr is a function variable referring to Int32. // -// Deprecated: Use Int32 instead. +// Deprecated: Use ptr.To instead. var Int32Ptr = Int32 // for back-compat // Int32Deref dereferences the int32 ptr and returns it if not nil, or else // returns def. -func Int32Deref(ptr *int32, def int32) int32 { - if ptr != nil { - return *ptr - } - return def -} +var Int32Deref = ptr.Deref[int32] // Int32PtrDerefOr is a function variable referring to Int32Deref. // -// Deprecated: Use Int32Deref instead. +// Deprecated: Use ptr.Deref instead. var Int32PtrDerefOr = Int32Deref // for back-compat // Int32Equal returns true if both arguments are nil or both arguments // dereference to the same value. -func Int32Equal(a, b *int32) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var Int32Equal = ptr.Equal[int32] // Uint returns a pointer to an uint -func Uint(i uint) *uint { - return &i -} +var Uint = ptr.To[uint] // UintPtr is a function variable referring to Uint. // -// Deprecated: Use Uint instead. +// Deprecated: Use ptr.To instead. var UintPtr = Uint // for back-compat // UintDeref dereferences the uint ptr and returns it if not nil, or else // returns def. -func UintDeref(ptr *uint, def uint) uint { - if ptr != nil { - return *ptr - } - return def -} +var UintDeref = ptr.Deref[uint] // UintPtrDerefOr is a function variable referring to UintDeref. // -// Deprecated: Use UintDeref instead. +// Deprecated: Use ptr.Deref instead. var UintPtrDerefOr = UintDeref // for back-compat // Uint32 returns a pointer to an uint32. -func Uint32(i uint32) *uint32 { - return &i -} +var Uint32 = ptr.To[uint32] // Uint32Ptr is a function variable referring to Uint32. // -// Deprecated: Use Uint32 instead. +// Deprecated: Use ptr.To instead. var Uint32Ptr = Uint32 // for back-compat // Uint32Deref dereferences the uint32 ptr and returns it if not nil, or else // returns def. -func Uint32Deref(ptr *uint32, def uint32) uint32 { - if ptr != nil { - return *ptr - } - return def -} +var Uint32Deref = ptr.Deref[uint32] // Uint32PtrDerefOr is a function variable referring to Uint32Deref. // -// Deprecated: Use Uint32Deref instead. +// Deprecated: Use ptr.Deref instead. var Uint32PtrDerefOr = Uint32Deref // for back-compat // Uint32Equal returns true if both arguments are nil or both arguments // dereference to the same value. -func Uint32Equal(a, b *uint32) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var Uint32Equal = ptr.Equal[uint32] // Int64 returns a pointer to an int64. -func Int64(i int64) *int64 { - return &i -} +var Int64 = ptr.To[int64] // Int64Ptr is a function variable referring to Int64. // -// Deprecated: Use Int64 instead. +// Deprecated: Use ptr.To instead. var Int64Ptr = Int64 // for back-compat // Int64Deref dereferences the int64 ptr and returns it if not nil, or else // returns def. -func Int64Deref(ptr *int64, def int64) int64 { - if ptr != nil { - return *ptr - } - return def -} +var Int64Deref = ptr.Deref[int64] // Int64PtrDerefOr is a function variable referring to Int64Deref. // -// Deprecated: Use Int64Deref instead. +// Deprecated: Use ptr.Deref instead. var Int64PtrDerefOr = Int64Deref // for back-compat // Int64Equal returns true if both arguments are nil or both arguments // dereference to the same value. -func Int64Equal(a, b *int64) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var Int64Equal = ptr.Equal[int64] // Uint64 returns a pointer to an uint64. -func Uint64(i uint64) *uint64 { - return &i -} +var Uint64 = ptr.To[uint64] // Uint64Ptr is a function variable referring to Uint64. // -// Deprecated: Use Uint64 instead. +// Deprecated: Use ptr.To instead. var Uint64Ptr = Uint64 // for back-compat // Uint64Deref dereferences the uint64 ptr and returns it if not nil, or else // returns def. -func Uint64Deref(ptr *uint64, def uint64) uint64 { - if ptr != nil { - return *ptr - } - return def -} +var Uint64Deref = ptr.Deref[uint64] // Uint64PtrDerefOr is a function variable referring to Uint64Deref. // -// Deprecated: Use Uint64Deref instead. +// Deprecated: Use ptr.Deref instead. var Uint64PtrDerefOr = Uint64Deref // for back-compat // Uint64Equal returns true if both arguments are nil or both arguments // dereference to the same value. -func Uint64Equal(a, b *uint64) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var Uint64Equal = ptr.Equal[uint64] // Bool returns a pointer to a bool. -func Bool(b bool) *bool { - return &b -} +var Bool = ptr.To[bool] // BoolPtr is a function variable referring to Bool. // -// Deprecated: Use Bool instead. +// Deprecated: Use ptr.To instead. var BoolPtr = Bool // for back-compat // BoolDeref dereferences the bool ptr and returns it if not nil, or else // returns def. -func BoolDeref(ptr *bool, def bool) bool { - if ptr != nil { - return *ptr - } - return def -} +var BoolDeref = ptr.Deref[bool] // BoolPtrDerefOr is a function variable referring to BoolDeref. // -// Deprecated: Use BoolDeref instead. +// Deprecated: Use ptr.Deref instead. var BoolPtrDerefOr = BoolDeref // for back-compat // BoolEqual returns true if both arguments are nil or both arguments // dereference to the same value. -func BoolEqual(a, b *bool) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var BoolEqual = ptr.Equal[bool] // String returns a pointer to a string. -func String(s string) *string { - return &s -} +var String = ptr.To[string] // StringPtr is a function variable referring to String. // -// Deprecated: Use String instead. +// Deprecated: Use ptr.To instead. var StringPtr = String // for back-compat // StringDeref dereferences the string ptr and returns it if not nil, or else // returns def. -func StringDeref(ptr *string, def string) string { - if ptr != nil { - return *ptr - } - return def -} +var StringDeref = ptr.Deref[string] // StringPtrDerefOr is a function variable referring to StringDeref. // -// Deprecated: Use StringDeref instead. +// Deprecated: Use ptr.Deref instead. var StringPtrDerefOr = StringDeref // for back-compat // StringEqual returns true if both arguments are nil or both arguments // dereference to the same value. -func StringEqual(a, b *string) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var StringEqual = ptr.Equal[string] // Float32 returns a pointer to a float32. -func Float32(i float32) *float32 { - return &i -} +var Float32 = ptr.To[float32] // Float32Ptr is a function variable referring to Float32. // -// Deprecated: Use Float32 instead. +// Deprecated: Use ptr.To instead. var Float32Ptr = Float32 // Float32Deref dereferences the float32 ptr and returns it if not nil, or else // returns def. -func Float32Deref(ptr *float32, def float32) float32 { - if ptr != nil { - return *ptr - } - return def -} +var Float32Deref = ptr.Deref[float32] // Float32PtrDerefOr is a function variable referring to Float32Deref. // -// Deprecated: Use Float32Deref instead. +// Deprecated: Use ptr.Deref instead. var Float32PtrDerefOr = Float32Deref // for back-compat // Float32Equal returns true if both arguments are nil or both arguments // dereference to the same value. -func Float32Equal(a, b *float32) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var Float32Equal = ptr.Equal[float32] // Float64 returns a pointer to a float64. -func Float64(i float64) *float64 { - return &i -} +var Float64 = ptr.To[float64] // Float64Ptr is a function variable referring to Float64. // -// Deprecated: Use Float64 instead. +// Deprecated: Use ptr.To instead. var Float64Ptr = Float64 // Float64Deref dereferences the float64 ptr and returns it if not nil, or else // returns def. -func Float64Deref(ptr *float64, def float64) float64 { - if ptr != nil { - return *ptr - } - return def -} +var Float64Deref = ptr.Deref[float64] // Float64PtrDerefOr is a function variable referring to Float64Deref. // -// Deprecated: Use Float64Deref instead. +// Deprecated: Use ptr.Deref instead. var Float64PtrDerefOr = Float64Deref // for back-compat // Float64Equal returns true if both arguments are nil or both arguments // dereference to the same value. -func Float64Equal(a, b *float64) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var Float64Equal = ptr.Equal[float64] // Duration returns a pointer to a time.Duration. -func Duration(d time.Duration) *time.Duration { - return &d -} +var Duration = ptr.To[time.Duration] // DurationDeref dereferences the time.Duration ptr and returns it if not nil, or else // returns def. -func DurationDeref(ptr *time.Duration, def time.Duration) time.Duration { - if ptr != nil { - return *ptr - } - return def -} +var DurationDeref = ptr.Deref[time.Duration] // DurationEqual returns true if both arguments are nil or both arguments // dereference to the same value. -func DurationEqual(a, b *time.Duration) bool { - if (a == nil) != (b == nil) { - return false - } - if a == nil { - return true - } - return *a == *b -} +var DurationEqual = ptr.Equal[time.Duration] diff --git a/vendor/k8s.io/utils/ptr/OWNERS b/vendor/k8s.io/utils/ptr/OWNERS new file mode 100644 index 0000000000..0d6392752a --- /dev/null +++ b/vendor/k8s.io/utils/ptr/OWNERS @@ -0,0 +1,10 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- apelisse +- stewart-yu +- thockin +reviewers: +- apelisse +- stewart-yu +- thockin diff --git a/vendor/k8s.io/utils/ptr/README.md b/vendor/k8s.io/utils/ptr/README.md new file mode 100644 index 0000000000..2ca8073dc7 --- /dev/null +++ b/vendor/k8s.io/utils/ptr/README.md @@ -0,0 +1,3 @@ +# Pointer + +This package provides some functions for pointer-based operations. diff --git a/vendor/k8s.io/utils/ptr/ptr.go b/vendor/k8s.io/utils/ptr/ptr.go new file mode 100644 index 0000000000..659ed3b9e2 --- /dev/null +++ b/vendor/k8s.io/utils/ptr/ptr.go @@ -0,0 +1,73 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package ptr + +import ( + "fmt" + "reflect" +) + +// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when, +// for example, an API struct is handled by plugins which need to distinguish +// "no plugin accepted this spec" from "this spec is empty". +// +// This function is only valid for structs and pointers to structs. Any other +// type will cause a panic. Passing a typed nil pointer will return true. +func AllPtrFieldsNil(obj interface{}) bool { + v := reflect.ValueOf(obj) + if !v.IsValid() { + panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj)) + } + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return true + } + v = v.Elem() + } + for i := 0; i < v.NumField(); i++ { + if v.Field(i).Kind() == reflect.Ptr && !v.Field(i).IsNil() { + return false + } + } + return true +} + +// To returns a pointer to the given value. +func To[T any](v T) *T { + return &v +} + +// Deref dereferences ptr and returns the value it points to if no nil, or else +// returns def. +func Deref[T any](ptr *T, def T) T { + if ptr != nil { + return *ptr + } + return def +} + +// Equal returns true if both arguments are nil or both arguments +// dereference to the same value. +func Equal[T comparable](a, b *T) bool { + if (a == nil) != (b == nil) { + return false + } + if a == nil { + return true + } + return *a == *b +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9f6db615d3..4b4e02363d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -12,6 +12,9 @@ github.com/NYTimes/gziphandler ## explicit; go 1.14 github.com/RoaringBitmap/roaring github.com/RoaringBitmap/roaring/internal +# github.com/Sirupsen/logrus v1.0.6 +## explicit +github.com/Sirupsen/logrus # github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df ## explicit; go 1.18 github.com/antlr/antlr4/runtime/Go/antlr/v4 @@ -125,7 +128,6 @@ github.com/golang/protobuf/protoc-gen-go/descriptor github.com/golang/protobuf/ptypes github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration -github.com/golang/protobuf/ptypes/empty github.com/golang/protobuf/ptypes/timestamp github.com/golang/protobuf/ptypes/wrappers # github.com/google/cel-go v0.16.1 @@ -179,14 +181,14 @@ github.com/google/uuid # github.com/gorilla/context v1.1.1 ## explicit github.com/gorilla/context -# github.com/gorilla/handlers v1.5.1 -## explicit; go 1.14 +# github.com/gorilla/handlers v1.5.2 +## explicit; go 1.20 github.com/gorilla/handlers -# github.com/gorilla/mux v1.8.0 -## explicit; go 1.12 +# github.com/gorilla/mux v1.8.1 +## explicit; go 1.20 github.com/gorilla/mux -# github.com/gorilla/websocket v1.5.0 -## explicit; go 1.12 +# github.com/gorilla/websocket v1.5.1 +## explicit; go 1.20 github.com/gorilla/websocket # github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 ## explicit @@ -223,7 +225,7 @@ github.com/kubernetes-csi/csi-lib-utils/protosanitizer # github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de ## explicit github.com/liggitt/tabwriter -# github.com/longhorn/backing-image-manager v1.6.0-dev-20231217.0.20240103150452-7f8aea1edd03 +# github.com/longhorn/backing-image-manager v1.6.0 ## explicit; go 1.21 github.com/longhorn/backing-image-manager/api github.com/longhorn/backing-image-manager/pkg/client @@ -231,7 +233,7 @@ github.com/longhorn/backing-image-manager/pkg/meta github.com/longhorn/backing-image-manager/pkg/rpc github.com/longhorn/backing-image-manager/pkg/types github.com/longhorn/backing-image-manager/pkg/util -# github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b +# github.com/longhorn/backupstore v0.0.0-20240207150630-b375644f1c57 ## explicit; go 1.21 github.com/longhorn/backupstore github.com/longhorn/backupstore/backupbackingimage @@ -240,7 +242,7 @@ github.com/longhorn/backupstore/logging github.com/longhorn/backupstore/systembackup github.com/longhorn/backupstore/types github.com/longhorn/backupstore/util -# github.com/longhorn/go-common-libs v0.0.0-20240109042507-23627e6416b7 +# github.com/longhorn/go-common-libs v0.0.0-20240207153251-d5e1ceae50ac ## explicit; go 1.21 github.com/longhorn/go-common-libs/exec github.com/longhorn/go-common-libs/io @@ -251,22 +253,22 @@ github.com/longhorn/go-common-libs/sys github.com/longhorn/go-common-libs/test/fake github.com/longhorn/go-common-libs/types github.com/longhorn/go-common-libs/utils -# github.com/longhorn/go-iscsi-helper v0.0.0-20240103085736-72aee873888a +# github.com/longhorn/go-iscsi-helper v0.0.0-20240207150711-0713d1c9f5d1 ## explicit; go 1.21 github.com/longhorn/go-iscsi-helper/iscsi github.com/longhorn/go-iscsi-helper/types github.com/longhorn/go-iscsi-helper/util -# github.com/longhorn/go-spdk-helper v0.0.0-20240117135122-26f8acb2a13d +# github.com/longhorn/go-spdk-helper v0.0.0-20240207162828-b64c3bc30abe ## explicit; go 1.21 github.com/longhorn/go-spdk-helper/pkg/types -# github.com/longhorn/longhorn-engine v1.6.0-dev-20240105.0.20240110095344-deb8b18a1558 +# github.com/longhorn/longhorn-engine v1.6.0 ## explicit; go 1.21 github.com/longhorn/longhorn-engine/pkg/meta github.com/longhorn/longhorn-engine/pkg/replica/client github.com/longhorn/longhorn-engine/pkg/types github.com/longhorn/longhorn-engine/pkg/util github.com/longhorn/longhorn-engine/proto/ptypes -# github.com/longhorn/longhorn-instance-manager v1.6.0-rc2.0.20240126090453-5a27dd0e4a81 +# github.com/longhorn/longhorn-instance-manager v1.6.0 ## explicit; go 1.21 github.com/longhorn/longhorn-instance-manager/pkg/api github.com/longhorn/longhorn-instance-manager/pkg/client @@ -274,7 +276,7 @@ github.com/longhorn/longhorn-instance-manager/pkg/imrpc github.com/longhorn/longhorn-instance-manager/pkg/meta github.com/longhorn/longhorn-instance-manager/pkg/types github.com/longhorn/longhorn-instance-manager/pkg/util -# github.com/longhorn/longhorn-share-manager v1.6.0-dev-20231217.0.20231226052309-99d57c1695ea +# github.com/longhorn/longhorn-share-manager v1.6.0 ## explicit; go 1.21 github.com/longhorn/longhorn-share-manager/pkg/client github.com/longhorn/longhorn-share-manager/pkg/crypto @@ -298,13 +300,11 @@ github.com/mailru/easyjson/jwriter github.com/matttproud/golang_protobuf_extensions/pbutil # github.com/mitchellh/copystructure v1.2.0 ## explicit; go 1.15 -github.com/mitchellh/copystructure # github.com/mitchellh/go-ps v1.0.0 ## explicit; go 1.13 github.com/mitchellh/go-ps # github.com/mitchellh/reflectwalk v1.0.2 ## explicit -github.com/mitchellh/reflectwalk # github.com/moby/sys/mountinfo v0.6.2 ## explicit; go 1.16 github.com/moby/sys/mountinfo @@ -374,11 +374,12 @@ github.com/rancher/dynamiclistener/server github.com/rancher/dynamiclistener/storage/file github.com/rancher/dynamiclistener/storage/kubernetes github.com/rancher/dynamiclistener/storage/memory -# github.com/rancher/go-rancher v0.1.1-0.20220412083059-ff12399dd57b +# github.com/rancher/go-rancher v0.1.1-0.20200505164325-7577995d47c0 ## explicit github.com/rancher/go-rancher/api github.com/rancher/go-rancher/client -# github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 +github.com/rancher/go-rancher/v2 +# github.com/rancher/lasso v0.0.0-20240123150939-7055397d6dfa ## explicit; go 1.20 github.com/rancher/lasso/pkg/cache github.com/rancher/lasso/pkg/client @@ -388,7 +389,7 @@ github.com/rancher/lasso/pkg/log github.com/rancher/lasso/pkg/mapper github.com/rancher/lasso/pkg/metrics github.com/rancher/lasso/pkg/scheme -# github.com/rancher/wrangler v1.1.1 +# github.com/rancher/wrangler v1.1.2 ## explicit; go 1.19 github.com/rancher/wrangler/pkg/apply github.com/rancher/wrangler/pkg/apply/injectors @@ -462,7 +463,7 @@ github.com/stoewer/go-strcase ## explicit; go 1.20 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/urfave/cli v1.22.13 +# github.com/urfave/cli v1.22.14 ## explicit; go 1.11 github.com/urfave/cli # github.com/yusufpapurcu/wmi v1.2.3 @@ -578,6 +579,7 @@ golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 golang.org/x/crypto/nacl/secretbox golang.org/x/crypto/salsa20/salsa +golang.org/x/crypto/ssh/terminal # golang.org/x/exp v0.0.0-20230725012225-302865e7556b ## explicit; go 1.20 golang.org/x/exp/constraints @@ -792,7 +794,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.28.5 => k8s.io/api v0.28.5 +# k8s.io/api v0.28.6 => k8s.io/api v0.28.5 ## explicit; go 1.20 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -870,7 +872,7 @@ k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalint k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1 k8s.io/apiextensions-apiserver/pkg/features -# k8s.io/apimachinery v0.28.5 => k8s.io/apimachinery v0.28.5 +# k8s.io/apimachinery v0.28.6 => k8s.io/apimachinery v0.28.5 ## explicit; go 1.20 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -1078,7 +1080,7 @@ k8s.io/apiserver/plugin/pkg/authorizer/webhook # k8s.io/cli-runtime v0.28.5 => k8s.io/cli-runtime v0.28.5 ## explicit; go 1.20 k8s.io/cli-runtime/pkg/printers -# k8s.io/client-go v0.28.5 => k8s.io/client-go v0.28.5 +# k8s.io/client-go v0.28.6 => k8s.io/client-go v0.28.5 ## explicit; go 1.20 k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1 @@ -1522,7 +1524,7 @@ k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1 # k8s.io/mount-utils v0.28.5 => k8s.io/mount-utils v0.28.5 ## explicit; go 1.20 k8s.io/mount-utils -# k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 +# k8s.io/utils v0.0.0-20240102154912-e7106e64919e ## explicit; go 1.18 k8s.io/utils/buffer k8s.io/utils/clock @@ -1537,6 +1539,7 @@ k8s.io/utils/lru k8s.io/utils/net k8s.io/utils/path k8s.io/utils/pointer +k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace # sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2