From 4120cd2b1a4e04c1ab0b996d5d506b7790819597 Mon Sep 17 00:00:00 2001 From: Tim Tkachev Date: Wed, 25 Oct 2023 17:37:18 +0300 Subject: [PATCH] v1.6.7 --- CHANGELOG.md | 26 +- README.md | 4 +- client.go | 538 ++++++++---------- config/config.go | 8 +- config/legacy-config.go | 8 +- internal/multierror/join.go | 41 ++ internal/validators/helper.go | 9 + legacy-client.go | 423 ++++++++------ pkg/cloudapi/account/add_user.go | 6 +- pkg/cloudapi/account/audits.go | 6 +- pkg/cloudapi/account/create.go | 6 +- pkg/cloudapi/account/delete.go | 6 +- pkg/cloudapi/account/delete_user.go | 8 +- pkg/cloudapi/account/disable_enable.go | 10 +- pkg/cloudapi/account/get.go | 4 +- .../account/get_consumed_account_units.go | 6 +- .../get_consumed_cloud_units_by_type.go | 6 +- pkg/cloudapi/account/get_consumption.go | 10 +- .../account/get_reserved_account_units.go | 6 +- .../account/get_resource_consumption.go | 6 +- pkg/cloudapi/account/list_computes.go | 6 +- pkg/cloudapi/account/list_deleted.go | 4 +- pkg/cloudapi/account/list_disks.go | 6 +- pkg/cloudapi/account/list_flipgroups.go | 6 +- pkg/cloudapi/account/list_rg.go | 8 +- pkg/cloudapi/account/list_templates.go | 8 +- pkg/cloudapi/account/list_vins.go | 8 +- pkg/cloudapi/account/restore.go | 6 +- pkg/cloudapi/account/update.go | 6 +- pkg/cloudapi/account/update_user.go | 6 +- pkg/cloudapi/bservice/create.go | 6 +- pkg/cloudapi/bservice/delete.go | 8 +- pkg/cloudapi/bservice/disable.go | 6 +- pkg/cloudapi/bservice/enable.go | 6 +- pkg/cloudapi/bservice/get.go | 4 +- pkg/cloudapi/bservice/group_add.go | 22 +- pkg/cloudapi/bservice/group_compute_remove.go | 8 +- pkg/cloudapi/bservice/group_get.go | 8 +- pkg/cloudapi/bservice/group_parent_add.go | 9 +- pkg/cloudapi/bservice/group_parent_remove.go | 14 +- pkg/cloudapi/bservice/group_remove.go | 6 +- pkg/cloudapi/bservice/group_resize.go | 6 +- pkg/cloudapi/bservice/group_start.go | 6 +- pkg/cloudapi/bservice/group_stop.go | 10 +- pkg/cloudapi/bservice/group_update.go | 10 +- pkg/cloudapi/bservice/group_update_extnet.go | 6 +- pkg/cloudapi/bservice/group_update_vins.go | 6 +- pkg/cloudapi/bservice/list_deleted.go | 4 +- pkg/cloudapi/bservice/restore.go | 6 +- pkg/cloudapi/bservice/snapshot_create.go | 6 +- pkg/cloudapi/bservice/snapshot_delete.go | 6 +- pkg/cloudapi/bservice/snapshot_list.go | 6 +- pkg/cloudapi/bservice/snapshot_rollback.go | 6 +- pkg/cloudapi/bservice/start.go | 6 +- pkg/cloudapi/bservice/stop.go | 6 +- .../compute/affinity_group_check_start.go | 6 +- pkg/cloudapi/compute/affinity_label_remove.go | 6 +- pkg/cloudapi/compute/affinity_label_set.go | 6 +- pkg/cloudapi/compute/affinity_relations.go | 6 +- pkg/cloudapi/compute/affinity_rule_add.go | 6 +- pkg/cloudapi/compute/affinity_rule_remove.go | 6 +- pkg/cloudapi/compute/affinity_rules_clear.go | 6 +- .../compute/anti_affinity_rule_add.go | 6 +- .../compute/anti_affinity_rule_remove.go | 6 +- .../compute/anti_affinity_rules_clear.go | 6 +- pkg/cloudapi/compute/attach_gpu.go | 6 +- pkg/cloudapi/compute/attach_pci_device.go | 6 +- pkg/cloudapi/compute/audits.go | 6 +- pkg/cloudapi/compute/boot_order_get.go | 6 +- pkg/cloudapi/compute/boot_order_set.go | 6 +- pkg/cloudapi/compute/cd_eject.go | 6 +- pkg/cloudapi/compute/cd_insert.go | 6 +- pkg/cloudapi/compute/change_link_state.go | 6 +- pkg/cloudapi/compute/clone.go | 6 +- pkg/cloudapi/compute/create_template.go | 10 +- pkg/cloudapi/compute/delete.go | 6 +- pkg/cloudapi/compute/delete_custom_fields.go | 6 +- pkg/cloudapi/compute/detach_gpu.go | 6 +- pkg/cloudapi/compute/detach_pci_device.go | 6 +- pkg/cloudapi/compute/disable.go | 6 +- pkg/cloudapi/compute/disk_add.go | 6 +- pkg/cloudapi/compute/disk_attach.go | 6 +- pkg/cloudapi/compute/disk_del.go | 6 +- pkg/cloudapi/compute/disk_detach.go | 6 +- pkg/cloudapi/compute/disk_qos.go | 6 +- pkg/cloudapi/compute/disk_resize.go | 6 +- pkg/cloudapi/compute/enable.go | 6 +- pkg/cloudapi/compute/get.go | 4 +- pkg/cloudapi/compute/get_audits.go | 6 +- pkg/cloudapi/compute/get_console_url.go | 6 +- pkg/cloudapi/compute/get_custom_fields.go | 6 +- pkg/cloudapi/compute/get_log.go | 14 +- pkg/cloudapi/compute/list_deleted.go | 2 +- pkg/cloudapi/compute/list_pci_device.go | 6 +- pkg/cloudapi/compute/list_vgpu.go | 6 +- pkg/cloudapi/compute/move_to_rg.go | 6 +- pkg/cloudapi/compute/net_attach.go | 8 +- pkg/cloudapi/compute/net_detach.go | 8 +- pkg/cloudapi/compute/pause.go | 6 +- pkg/cloudapi/compute/pfw_add.go | 6 +- pkg/cloudapi/compute/pfw_del.go | 8 +- pkg/cloudapi/compute/pfw_list.go | 6 +- pkg/cloudapi/compute/pin_to_stack.go | 6 +- pkg/cloudapi/compute/power_cycle.go | 6 +- pkg/cloudapi/compute/reboot.go | 8 +- pkg/cloudapi/compute/redeploy.go | 10 +- pkg/cloudapi/compute/reset.go | 8 +- pkg/cloudapi/compute/resize.go | 8 +- pkg/cloudapi/compute/restore.go | 8 +- pkg/cloudapi/compute/resume.go | 6 +- pkg/cloudapi/compute/set_custom_fields.go | 7 +- pkg/cloudapi/compute/snapshot_create.go | 6 +- pkg/cloudapi/compute/snapshot_delete.go | 8 +- pkg/cloudapi/compute/snapshot_list.go | 8 +- pkg/cloudapi/compute/snapshot_rollback.go | 8 +- pkg/cloudapi/compute/snapshot_usage.go | 8 +- pkg/cloudapi/compute/start.go | 6 +- pkg/cloudapi/compute/stop.go | 8 +- pkg/cloudapi/compute/tag_add.go | 6 +- pkg/cloudapi/compute/tag_remove.go | 6 +- pkg/cloudapi/compute/unpin_from_stack.go | 8 +- pkg/cloudapi/compute/update.go | 6 +- pkg/cloudapi/compute/user_grant.go | 8 +- pkg/cloudapi/compute/user_list.go | 6 +- pkg/cloudapi/compute/user_revoke.go | 6 +- pkg/cloudapi/compute/user_update.go | 6 +- pkg/cloudapi/disks/create.go | 9 +- pkg/cloudapi/disks/delete.go | 6 +- pkg/cloudapi/disks/delete_disks.go | 6 +- pkg/cloudapi/disks/get.go | 4 +- pkg/cloudapi/disks/limitio.go | 6 +- pkg/cloudapi/disks/list_deleted.go | 2 +- pkg/cloudapi/disks/list_types.go | 2 +- pkg/cloudapi/disks/list_unattached.go | 2 +- pkg/cloudapi/disks/rename.go | 8 +- pkg/cloudapi/disks/resize.go | 12 +- pkg/cloudapi/disks/restore.go | 8 +- pkg/cloudapi/disks/search.go | 4 +- pkg/cloudapi/disks/share.go | 6 +- pkg/cloudapi/disks/snapshot_delete.go | 6 +- pkg/cloudapi/disks/snapshot_rollback.go | 8 +- pkg/cloudapi/disks/unshare.go | 6 +- pkg/cloudapi/extnet/get.go | 4 +- pkg/cloudapi/extnet/list_computes.go | 6 +- pkg/cloudapi/flipgroup/compute_add.go | 6 +- pkg/cloudapi/flipgroup/compute_remove.go | 6 +- pkg/cloudapi/flipgroup/create.go | 6 +- pkg/cloudapi/flipgroup/delete.go | 6 +- pkg/cloudapi/flipgroup/edit.go | 6 +- pkg/cloudapi/flipgroup/get.go | 4 +- pkg/cloudapi/image/create.go | 6 +- pkg/cloudapi/image/create_virtual.go | 6 +- pkg/cloudapi/image/delete.go | 6 +- pkg/cloudapi/image/get.go | 4 +- pkg/cloudapi/image/link.go | 6 +- pkg/cloudapi/image/rename.go | 6 +- pkg/cloudapi/k8ci/get.go | 4 +- pkg/cloudapi/k8ci/list_deleted.go | 2 +- pkg/cloudapi/k8s/create.go | 7 +- pkg/cloudapi/k8s/delete.go | 6 +- pkg/cloudapi/k8s/delete_master_from_group.go | 6 +- pkg/cloudapi/k8s/delete_worker_from_group.go | 6 +- pkg/cloudapi/k8s/disable_enable.go | 10 +- pkg/cloudapi/k8s/find_group_by_label.go | 6 +- pkg/cloudapi/k8s/get.go | 4 +- pkg/cloudapi/k8s/get_config.go | 6 +- pkg/cloudapi/k8s/get_node_annotations.go | 6 +- pkg/cloudapi/k8s/get_node_labels.go | 6 +- pkg/cloudapi/k8s/get_node_taints.go | 6 +- .../k8s/get_worker_nodes_meta_data.go | 8 +- pkg/cloudapi/k8s/list_deleted.go | 2 +- pkg/cloudapi/k8s/restore.go | 8 +- pkg/cloudapi/k8s/start.go | 6 +- pkg/cloudapi/k8s/stop.go | 6 +- pkg/cloudapi/k8s/update.go | 6 +- .../k8s/update_worker_nodes_meta_data.go | 8 +- pkg/cloudapi/k8s/worker_add.go | 8 +- pkg/cloudapi/k8s/worker_reset.go | 6 +- pkg/cloudapi/k8s/worker_restart.go | 6 +- pkg/cloudapi/k8s/workers_group_add.go | 6 +- pkg/cloudapi/k8s/workers_group_delete.go | 6 +- pkg/cloudapi/k8s/workers_group_get_by_name.go | 6 +- pkg/cloudapi/kvmppc/create.go | 6 +- pkg/cloudapi/kvmppc/create_blank.go | 6 +- pkg/cloudapi/kvmx86/create.go | 6 +- pkg/cloudapi/kvmx86/create_blank.go | 6 +- pkg/cloudapi/lb/backend_create.go | 6 +- pkg/cloudapi/lb/backend_delete.go | 6 +- pkg/cloudapi/lb/backend_server_add.go | 6 +- pkg/cloudapi/lb/backend_server_delete.go | 8 +- pkg/cloudapi/lb/backend_server_update.go | 8 +- pkg/cloudapi/lb/backend_update.go | 6 +- pkg/cloudapi/lb/config_reset.go | 6 +- pkg/cloudapi/lb/create.go | 6 +- pkg/cloudapi/lb/delete.go | 6 +- pkg/cloudapi/lb/disable_enable.go | 10 +- pkg/cloudapi/lb/frontend_bind.go | 6 +- pkg/cloudapi/lb/frontend_bind_delete.go | 6 +- pkg/cloudapi/lb/frontend_bind_update.go | 6 +- pkg/cloudapi/lb/frontend_create.go | 6 +- pkg/cloudapi/lb/frontend_delete.go | 6 +- pkg/cloudapi/lb/get.go | 4 +- pkg/cloudapi/lb/list_deleted.go | 2 +- pkg/cloudapi/lb/make_highly_available.go | 8 +- pkg/cloudapi/lb/restart.go | 6 +- pkg/cloudapi/lb/restore.go | 8 +- pkg/cloudapi/lb/start.go | 6 +- pkg/cloudapi/lb/stop.go | 6 +- pkg/cloudapi/lb/update.go | 6 +- pkg/cloudapi/lb/updateSysctParams.go | 8 +- pkg/cloudapi/rg/access_grant.go | 6 +- pkg/cloudapi/rg/access_revoke.go | 6 +- pkg/cloudapi/rg/affinity_group_computes.go | 6 +- pkg/cloudapi/rg/affinity_groups_get.go | 6 +- pkg/cloudapi/rg/affinity_groups_list.go | 6 +- pkg/cloudapi/rg/audits.go | 6 +- pkg/cloudapi/rg/create.go | 6 +- pkg/cloudapi/rg/delete.go | 6 +- pkg/cloudapi/rg/disable.go | 6 +- pkg/cloudapi/rg/enable.go | 6 +- pkg/cloudapi/rg/get.go | 4 +- pkg/cloudapi/rg/get_resource_consumption.go | 6 +- pkg/cloudapi/rg/list_computes.go | 6 +- pkg/cloudapi/rg/list_deleted.go | 2 +- pkg/cloudapi/rg/list_lb.go | 6 +- pkg/cloudapi/rg/list_pfw.go | 6 +- pkg/cloudapi/rg/list_vins.go | 6 +- pkg/cloudapi/rg/restore.go | 6 +- pkg/cloudapi/rg/set_def_net.go | 6 +- pkg/cloudapi/rg/update.go | 6 +- pkg/cloudapi/rg/usage.go | 6 +- pkg/cloudapi/stack/get.go | 4 +- pkg/cloudapi/tasks/get.go | 4 +- pkg/cloudapi/vins/audits.go | 6 +- pkg/cloudapi/vins/create_in_account.go | 6 +- pkg/cloudapi/vins/create_in_rg.go | 6 +- pkg/cloudapi/vins/delete.go | 6 +- pkg/cloudapi/vins/disable_enable.go | 10 +- pkg/cloudapi/vins/extnet_connect.go | 6 +- pkg/cloudapi/vins/extnet_disconnect.go | 8 +- pkg/cloudapi/vins/extnet_list.go | 8 +- pkg/cloudapi/vins/get.go | 4 +- pkg/cloudapi/vins/ip_list.go | 8 +- pkg/cloudapi/vins/ip_release.go | 6 +- pkg/cloudapi/vins/ip_reserve.go | 6 +- pkg/cloudapi/vins/list_deleted.go | 2 +- pkg/cloudapi/vins/nat_rule_add.go | 6 +- pkg/cloudapi/vins/nat_rule_del.go | 8 +- pkg/cloudapi/vins/nat_rule_list.go | 6 +- pkg/cloudapi/vins/restore.go | 6 +- pkg/cloudapi/vins/search.go | 4 +- .../vins/static_route_access_grant.go | 10 +- .../vins/static_route_access_revoke.go | 10 +- pkg/cloudapi/vins/static_route_add.go | 8 +- pkg/cloudapi/vins/static_route_del.go | 10 +- pkg/cloudapi/vins/static_route_list.go | 8 +- pkg/cloudapi/vins/vnfdev_redeploy.go | 8 +- pkg/cloudapi/vins/vnfdev_restart.go | 8 +- pkg/cloudbroker/account/add_user.go | 6 +- pkg/cloudbroker/account/audits.go | 6 +- pkg/cloudbroker/account/create.go | 6 +- pkg/cloudbroker/account/delete.go | 6 +- pkg/cloudbroker/account/delete_accounts.go | 8 +- pkg/cloudbroker/account/delete_user.go | 8 +- pkg/cloudbroker/account/disable.go | 6 +- pkg/cloudbroker/account/disable_accounts.go | 6 +- pkg/cloudbroker/account/enable.go | 6 +- pkg/cloudbroker/account/enable_accounts.go | 6 +- pkg/cloudbroker/account/get.go | 4 +- .../account/get_resource_consumption.go | 8 +- pkg/cloudbroker/account/list_computes.go | 8 +- pkg/cloudbroker/account/list_deleted.go | 2 +- pkg/cloudbroker/account/list_disks.go | 8 +- pkg/cloudbroker/account/list_flip_groups.go | 8 +- pkg/cloudbroker/account/list_rg.go | 8 +- pkg/cloudbroker/account/list_vins.go | 8 +- pkg/cloudbroker/account/restore.go | 6 +- .../account/set_cpu_allocation_parameter.go | 6 +- .../account/set_cpu_allocation_ratio.go | 11 +- pkg/cloudbroker/account/update.go | 6 +- .../account/update_resource_types.go | 6 +- pkg/cloudbroker/account/update_user.go | 6 +- pkg/cloudbroker/apiaccess/api_find.go | 6 +- pkg/cloudbroker/apiaccess/apis_exclude.go | 10 +- pkg/cloudbroker/apiaccess/apis_include.go | 8 +- pkg/cloudbroker/apiaccess/copy.go | 6 +- pkg/cloudbroker/apiaccess/create.go | 6 +- pkg/cloudbroker/apiaccess/delete.go | 6 +- pkg/cloudbroker/apiaccess/desc_update.go | 6 +- pkg/cloudbroker/apiaccess/get.go | 4 +- pkg/cloudbroker/apiaccess/list.go | 9 - pkg/cloudbroker/apiaccess/list_deleted.go | 11 +- pkg/cloudbroker/apiaccess/set_default.go | 6 +- pkg/cloudbroker/apiaccess/subtract.go | 6 +- pkg/cloudbroker/apiaccess/union.go | 8 +- pkg/cloudbroker/apiaccess/update.go | 6 +- pkg/cloudbroker/apiaccess/user_list.go | 6 +- pkg/cloudbroker/backup/create_disk_backup.go | 10 +- pkg/cloudbroker/backup/create_disks_backup.go | 10 +- pkg/cloudbroker/backup/delete_disk_backup.go | 10 +- pkg/cloudbroker/backup/list_backup_paths.go | 6 +- .../backup/restore_disk_from_backup.go | 10 +- .../backup/restore_disks_from_backup.go | 10 +- .../compute/affinity_group_check_start.go | 6 +- .../compute/affinity_label_remove.go | 6 +- pkg/cloudbroker/compute/affinity_label_set.go | 8 +- pkg/cloudbroker/compute/affinity_relations.go | 6 +- pkg/cloudbroker/compute/affinity_rule_add.go | 8 +- .../compute/affinity_rule_remove.go | 6 +- .../compute/affinity_rules_clear.go | 8 +- .../compute/anti_affinity_rule_add.go | 8 +- .../compute/anti_affinity_rule_clear.go | 6 +- .../compute/anti_affinity_rule_remove.go | 8 +- pkg/cloudbroker/compute/attach_gpu.go | 8 +- pkg/cloudbroker/compute/attach_pci_device.go | 8 +- pkg/cloudbroker/compute/audits.go | 6 +- pkg/cloudbroker/compute/boot_order_get.go | 6 +- pkg/cloudbroker/compute/boot_order_set.go | 6 +- pkg/cloudbroker/compute/cd_eject.go | 8 +- pkg/cloudbroker/compute/cd_insert.go | 8 +- pkg/cloudbroker/compute/change_link_state.go | 6 +- pkg/cloudbroker/compute/clone.go | 6 +- pkg/cloudbroker/compute/computeci_set.go | 6 +- pkg/cloudbroker/compute/computeci_unset.go | 6 +- pkg/cloudbroker/compute/create_template.go | 10 +- pkg/cloudbroker/compute/delete.go | 6 +- pkg/cloudbroker/compute/detach_gpu.go | 8 +- pkg/cloudbroker/compute/detach_pci_device.go | 8 +- pkg/cloudbroker/compute/disable.go | 6 +- pkg/cloudbroker/compute/disk_add.go | 6 +- pkg/cloudbroker/compute/disk_attach.go | 6 +- pkg/cloudbroker/compute/disk_del.go | 8 +- pkg/cloudbroker/compute/disk_detach.go | 8 +- pkg/cloudbroker/compute/disk_qos.go | 8 +- pkg/cloudbroker/compute/disk_resize.go | 8 +- pkg/cloudbroker/compute/enable.go | 6 +- pkg/cloudbroker/compute/get.go | 4 +- pkg/cloudbroker/compute/get_audits.go | 6 +- pkg/cloudbroker/compute/get_console_url.go | 6 +- pkg/cloudbroker/compute/get_log.go | 6 +- pkg/cloudbroker/compute/list_deleted.go | 2 +- pkg/cloudbroker/compute/list_pci_device.go | 8 +- pkg/cloudbroker/compute/list_vgpu.go | 8 +- pkg/cloudbroker/compute/mass_delete.go | 6 +- pkg/cloudbroker/compute/mass_reboot.go | 6 +- .../compute/mass_repair_boot_fs.go | 8 +- pkg/cloudbroker/compute/mass_start.go | 6 +- pkg/cloudbroker/compute/mass_stop.go | 6 +- pkg/cloudbroker/compute/migrate.go | 6 +- pkg/cloudbroker/compute/migrate_storage.go | 6 +- .../compute/migrate_storage_abort.go | 8 +- .../compute/migrate_storage_clean_up.go | 6 +- .../compute/migrate_storage_info.go | 6 +- pkg/cloudbroker/compute/move_to_rg.go | 6 +- pkg/cloudbroker/compute/net_attach.go | 8 +- pkg/cloudbroker/compute/net_detach.go | 8 +- pkg/cloudbroker/compute/net_qos.go | 8 +- pkg/cloudbroker/compute/pause.go | 6 +- pkg/cloudbroker/compute/pfw_add.go | 8 +- pkg/cloudbroker/compute/pfw_del.go | 8 +- pkg/cloudbroker/compute/pfw_list.go | 6 +- pkg/cloudbroker/compute/pin_to_stack.go | 8 +- pkg/cloudbroker/compute/power_cycle.go | 6 +- pkg/cloudbroker/compute/reboot.go | 8 +- pkg/cloudbroker/compute/redeploy.go | 8 +- pkg/cloudbroker/compute/registration.go | 6 +- pkg/cloudbroker/compute/repair_boot_fs.go | 8 +- pkg/cloudbroker/compute/reset.go | 8 +- pkg/cloudbroker/compute/resize.go | 8 +- pkg/cloudbroker/compute/restore.go | 8 +- pkg/cloudbroker/compute/resume.go | 8 +- pkg/cloudbroker/compute/set_custom_fields.go | 7 +- pkg/cloudbroker/compute/snapshot_create.go | 8 +- pkg/cloudbroker/compute/snapshot_delete.go | 8 +- .../compute/snapshot_evict_disk.go | 10 +- pkg/cloudbroker/compute/snapshot_list.go | 8 +- pkg/cloudbroker/compute/snapshot_rollback.go | 8 +- pkg/cloudbroker/compute/snapshot_usage.go | 8 +- pkg/cloudbroker/compute/start.go | 6 +- pkg/cloudbroker/compute/stop.go | 6 +- pkg/cloudbroker/compute/tag_add.go | 8 +- pkg/cloudbroker/compute/tag_remove.go | 6 +- pkg/cloudbroker/compute/unpin_from_stack.go | 8 +- pkg/cloudbroker/compute/update.go | 6 +- pkg/cloudbroker/compute/user_grant.go | 8 +- pkg/cloudbroker/compute/user_list.go | 6 +- pkg/cloudbroker/compute/user_revoke.go | 6 +- pkg/cloudbroker/compute/user_update.go | 6 +- pkg/cloudbroker/disks/create.go | 6 +- pkg/cloudbroker/disks/delete.go | 6 +- pkg/cloudbroker/disks/delete_disks.go | 6 +- pkg/cloudbroker/disks/get.go | 4 +- pkg/cloudbroker/disks/limit_io.go | 8 +- pkg/cloudbroker/disks/list_deleted.go | 4 +- pkg/cloudbroker/disks/list_types.go | 13 +- pkg/cloudbroker/disks/list_unattached.go | 2 +- pkg/cloudbroker/disks/rename.go | 8 +- pkg/cloudbroker/disks/resize.go | 12 +- pkg/cloudbroker/disks/restore.go | 8 +- pkg/cloudbroker/disks/search.go | 4 +- pkg/cloudbroker/disks/share.go | 6 +- pkg/cloudbroker/disks/snapshot_delete.go | 6 +- pkg/cloudbroker/disks/snapshot_rollback.go | 8 +- pkg/cloudbroker/disks/unshare.go | 6 +- pkg/cloudbroker/extnet/access_add.go | 8 +- pkg/cloudbroker/extnet/access_remove.go | 8 +- pkg/cloudbroker/extnet/create.go | 6 +- pkg/cloudbroker/extnet/default_qos_update.go | 6 +- pkg/cloudbroker/extnet/destroy.go | 6 +- pkg/cloudbroker/extnet/device_deploy.go | 6 +- pkg/cloudbroker/extnet/device_migrate.go | 8 +- pkg/cloudbroker/extnet/device_remove.go | 6 +- pkg/cloudbroker/extnet/device_restart.go | 6 +- pkg/cloudbroker/extnet/disable.go | 6 +- pkg/cloudbroker/extnet/dns_apply.go | 6 +- pkg/cloudbroker/extnet/enable.go | 6 +- pkg/cloudbroker/extnet/get.go | 4 +- pkg/cloudbroker/extnet/ips_exclude.go | 8 +- pkg/cloudbroker/extnet/ips_exclude_range.go | 8 +- pkg/cloudbroker/extnet/ips_include.go | 8 +- pkg/cloudbroker/extnet/ips_include_range.go | 8 +- pkg/cloudbroker/extnet/ntp_apply.go | 6 +- pkg/cloudbroker/extnet/set_default.go | 6 +- .../extnet/static_route_access_grant.go | 8 +- .../extnet/static_route_access_revoke.go | 8 +- pkg/cloudbroker/extnet/static_route_add.go | 10 +- pkg/cloudbroker/extnet/static_route_del.go | 8 +- pkg/cloudbroker/extnet/static_route_list.go | 8 +- pkg/cloudbroker/extnet/update.go | 6 +- pkg/cloudbroker/flipgroup/compute_add.go | 8 +- pkg/cloudbroker/flipgroup/compute_remove.go | 8 +- pkg/cloudbroker/flipgroup/create.go | 6 +- pkg/cloudbroker/flipgroup/delete.go | 6 +- pkg/cloudbroker/flipgroup/edit.go | 6 +- pkg/cloudbroker/flipgroup/get.go | 4 +- pkg/cloudbroker/grid/add.go | 6 +- pkg/cloudbroker/grid/change_settings.go | 6 +- pkg/cloudbroker/grid/check_vms.go | 6 +- pkg/cloudbroker/grid/create_system_space.go | 6 +- .../grid/execute_maintenance_script.go | 6 +- pkg/cloudbroker/grid/get.go | 4 +- pkg/cloudbroker/grid/get_backup.go | 10 +- pkg/cloudbroker/grid/get_diagnosis.go | 14 +- .../grid/get_resource_consumption.go | 6 +- pkg/cloudbroker/grid/list_emails.go | 3 +- pkg/cloudbroker/grid/purge_logs.go | 6 +- pkg/cloudbroker/grid/rename.go | 6 +- pkg/cloudbroker/grid/services_restart.go | 10 +- .../grid/set_cpu_allocation_parameter.go | 6 +- .../grid/set_cpu_allocation_ratio.go | 6 +- .../grid/set_cpu_allocation_ratio_for_vm.go | 8 +- .../grid/set_mem_allocation_ratio.go | 6 +- pkg/cloudbroker/group/get.go | 4 +- pkg/cloudbroker/group/list.go | 13 +- pkg/cloudbroker/image/computeci_set.go | 8 +- pkg/cloudbroker/image/computeci_unset.go | 8 +- pkg/cloudbroker/image/create_cdrom_image.go | 6 +- pkg/cloudbroker/image/create_image.go | 6 +- pkg/cloudbroker/image/create_virtual.go | 6 +- pkg/cloudbroker/image/delete.go | 6 +- pkg/cloudbroker/image/delete_cdrom_image.go | 8 +- pkg/cloudbroker/image/delete_images.go | 6 +- pkg/cloudbroker/image/disable.go | 6 +- pkg/cloudbroker/image/edit.go | 6 +- pkg/cloudbroker/image/enable.go | 6 +- pkg/cloudbroker/image/get.go | 4 +- pkg/cloudbroker/image/link.go | 6 +- pkg/cloudbroker/image/list_stacks.go | 6 +- pkg/cloudbroker/image/rename.go | 6 +- pkg/cloudbroker/image/share.go | 6 +- pkg/cloudbroker/image/sync_create_image.go | 6 +- pkg/cloudbroker/image/update_nodes.go | 8 +- pkg/cloudbroker/k8ci/create.go | 6 +- pkg/cloudbroker/k8ci/delete.go | 6 +- pkg/cloudbroker/k8ci/disable.go | 6 +- pkg/cloudbroker/k8ci/enable.go | 6 +- pkg/cloudbroker/k8ci/get.go | 4 +- pkg/cloudbroker/k8ci/list_deleted.go | 2 +- pkg/cloudbroker/k8ci/restore.go | 6 +- pkg/cloudbroker/k8s/create.go | 6 +- pkg/cloudbroker/k8s/delete.go | 6 +- .../k8s/delete_master_from_group.go | 6 +- .../k8s/delete_worker_from_group.go | 6 +- pkg/cloudbroker/k8s/disable.go | 6 +- pkg/cloudbroker/k8s/enable.go | 6 +- pkg/cloudbroker/k8s/find_group_by_label.go | 8 +- pkg/cloudbroker/k8s/get.go | 4 +- pkg/cloudbroker/k8s/get_config.go | 6 +- pkg/cloudbroker/k8s/get_node_annotations.go | 6 +- pkg/cloudbroker/k8s/get_node_labels.go | 6 +- pkg/cloudbroker/k8s/get_node_taints.go | 6 +- .../k8s/get_worker_nodes_meta_data.go | 8 +- pkg/cloudbroker/k8s/list_deleted.go | 2 +- pkg/cloudbroker/k8s/restore.go | 8 +- pkg/cloudbroker/k8s/start.go | 6 +- pkg/cloudbroker/k8s/stop.go | 6 +- pkg/cloudbroker/k8s/update.go | 6 +- .../k8s/update_worker_nodes_meta_data.go | 8 +- pkg/cloudbroker/k8s/worker_add.go | 6 +- pkg/cloudbroker/k8s/worker_reset.go | 6 +- pkg/cloudbroker/k8s/worker_restart.go | 8 +- pkg/cloudbroker/k8s/workers_group_add.go | 6 +- pkg/cloudbroker/k8s/workers_group_delete.go | 6 +- .../k8s/workers_group_get_by_name.go | 6 +- pkg/cloudbroker/kvmppc/create.go | 6 +- pkg/cloudbroker/kvmppc/create_blank.go | 6 +- pkg/cloudbroker/kvmppc/mass_create.go | 6 +- pkg/cloudbroker/kvmx86/create.go | 8 +- pkg/cloudbroker/kvmx86/create_blank.go | 8 +- pkg/cloudbroker/kvmx86/mass_create.go | 6 +- pkg/cloudbroker/lb/backend_create.go | 8 +- pkg/cloudbroker/lb/backend_delete.go | 6 +- pkg/cloudbroker/lb/backend_server_add.go | 6 +- pkg/cloudbroker/lb/backend_server_delete.go | 6 +- pkg/cloudbroker/lb/backend_server_update.go | 6 +- pkg/cloudbroker/lb/backend_update.go | 6 +- pkg/cloudbroker/lb/config_reset.go | 8 +- pkg/cloudbroker/lb/create.go | 6 +- pkg/cloudbroker/lb/delete.go | 6 +- pkg/cloudbroker/lb/disable.go | 6 +- pkg/cloudbroker/lb/enable.go | 6 +- pkg/cloudbroker/lb/frontend_bind.go | 6 +- pkg/cloudbroker/lb/frontend_bind_delete.go | 6 +- pkg/cloudbroker/lb/frontend_binding_update.go | 6 +- pkg/cloudbroker/lb/frontend_create.go | 6 +- pkg/cloudbroker/lb/frontend_delete.go | 6 +- pkg/cloudbroker/lb/get.go | 4 +- pkg/cloudbroker/lb/list_deleted.go | 3 +- pkg/cloudbroker/lb/make_highly_available.go | 8 +- pkg/cloudbroker/lb/restart.go | 6 +- pkg/cloudbroker/lb/restore.go | 8 +- pkg/cloudbroker/lb/start.go | 8 +- pkg/cloudbroker/lb/stop.go | 6 +- pkg/cloudbroker/lb/update.go | 6 +- pkg/cloudbroker/lb/updateSysctParams.go | 8 +- pkg/cloudbroker/pcidevice/create.go | 6 +- pkg/cloudbroker/pcidevice/delete.go | 8 +- pkg/cloudbroker/pcidevice/disable.go | 8 +- pkg/cloudbroker/pcidevice/enable.go | 8 +- pkg/cloudbroker/rg/access_grant.go | 6 +- pkg/cloudbroker/rg/access_revoke.go | 6 +- pkg/cloudbroker/rg/affinity_group_computes.go | 6 +- pkg/cloudbroker/rg/affinity_groups_get.go | 8 +- pkg/cloudbroker/rg/affinity_groups_list.go | 6 +- pkg/cloudbroker/rg/audits.go | 6 +- pkg/cloudbroker/rg/create.go | 6 +- pkg/cloudbroker/rg/delete.go | 6 +- pkg/cloudbroker/rg/disable.go | 6 +- pkg/cloudbroker/rg/enable.go | 6 +- pkg/cloudbroker/rg/get.go | 4 +- .../rg/get_resource_consumption.go | 6 +- pkg/cloudbroker/rg/list_computes.go | 6 +- pkg/cloudbroker/rg/list_deleted.go | 2 +- pkg/cloudbroker/rg/list_lb.go | 8 +- pkg/cloudbroker/rg/list_pfw.go | 8 +- pkg/cloudbroker/rg/list_vins.go | 8 +- pkg/cloudbroker/rg/mass_delete.go | 6 +- pkg/cloudbroker/rg/mass_disable.go | 6 +- pkg/cloudbroker/rg/mass_enable.go | 6 +- pkg/cloudbroker/rg/restore.go | 6 +- .../rg/set_cpu_allocation_parameter.go | 6 +- .../rg/set_cpu_allocation_ratio.go | 6 +- pkg/cloudbroker/rg/set_def_net.go | 6 +- pkg/cloudbroker/rg/update.go | 6 +- pkg/cloudbroker/rg/update_resource_types.go | 7 +- pkg/cloudbroker/rg/usage.go | 6 +- pkg/cloudbroker/sep/access_grant.go | 8 +- pkg/cloudbroker/sep/access_grant_to_pool.go | 8 +- pkg/cloudbroker/sep/access_revoke.go | 8 +- pkg/cloudbroker/sep/access_revoke_to_pool.go | 8 +- pkg/cloudbroker/sep/add_consumer_nodes.go | 8 +- pkg/cloudbroker/sep/add_provider_nodes.go | 8 +- pkg/cloudbroker/sep/config_field_edit.go | 8 +- pkg/cloudbroker/sep/config_insert.go | 8 +- pkg/cloudbroker/sep/config_validate.go | 8 +- pkg/cloudbroker/sep/consumption.go | 8 +- pkg/cloudbroker/sep/create.go | 6 +- pkg/cloudbroker/sep/decommission.go | 6 +- pkg/cloudbroker/sep/del_consumer_nodes.go | 8 +- pkg/cloudbroker/sep/delete.go | 6 +- pkg/cloudbroker/sep/disable.go | 6 +- pkg/cloudbroker/sep/disk_list.go | 8 +- pkg/cloudbroker/sep/enable.go | 6 +- pkg/cloudbroker/sep/get.go | 4 +- pkg/cloudbroker/sep/get_config.go | 6 +- pkg/cloudbroker/sep/get_pool.go | 6 +- pkg/cloudbroker/sep/update_capacity_limit.go | 6 +- pkg/cloudbroker/stack/get.go | 4 +- pkg/cloudbroker/tasks/get.go | 4 +- pkg/cloudbroker/user/api_list.go | 6 +- pkg/cloudbroker/user/apiaccess_join.go | 6 +- pkg/cloudbroker/user/apiaccess_leave.go | 6 +- pkg/cloudbroker/user/apiaccess_list.go | 6 +- pkg/cloudbroker/user/create.go | 6 +- pkg/cloudbroker/user/delete.go | 6 +- pkg/cloudbroker/user/delete_by_guid.go | 6 +- pkg/cloudbroker/user/delete_users.go | 12 +- pkg/cloudbroker/user/get.go | 4 +- pkg/cloudbroker/user/get_audit.go | 13 +- .../user/get_matching_usernames.go | 6 +- pkg/cloudbroker/user/list.go | 9 - pkg/cloudbroker/vgpu/allocate.go | 6 +- pkg/cloudbroker/vgpu/create.go | 6 +- pkg/cloudbroker/vgpu/deallocate.go | 6 +- pkg/cloudbroker/vgpu/destroy.go | 6 +- pkg/cloudbroker/vins/audits.go | 6 +- pkg/cloudbroker/vins/create_in_account.go | 10 +- pkg/cloudbroker/vins/create_in_rg.go | 6 +- pkg/cloudbroker/vins/default_qos_update.go | 8 +- pkg/cloudbroker/vins/delete.go | 6 +- pkg/cloudbroker/vins/disable.go | 6 +- pkg/cloudbroker/vins/enable.go | 6 +- pkg/cloudbroker/vins/extnet_connect.go | 8 +- pkg/cloudbroker/vins/extnet_disconnect.go | 8 +- pkg/cloudbroker/vins/extnet_list.go | 8 +- pkg/cloudbroker/vins/get.go | 4 +- pkg/cloudbroker/vins/ip_list.go | 8 +- pkg/cloudbroker/vins/ip_release.go | 8 +- pkg/cloudbroker/vins/ip_reserve.go | 6 +- pkg/cloudbroker/vins/list_deleted.go | 2 +- pkg/cloudbroker/vins/mass_delete.go | 6 +- pkg/cloudbroker/vins/mass_disable.go | 6 +- pkg/cloudbroker/vins/mass_enable.go | 6 +- pkg/cloudbroker/vins/nat_rule_add.go | 8 +- pkg/cloudbroker/vins/nat_rule_del.go | 8 +- pkg/cloudbroker/vins/nat_rule_list.go | 6 +- pkg/cloudbroker/vins/net_qos.go | 6 +- pkg/cloudbroker/vins/restore.go | 6 +- pkg/cloudbroker/vins/search.go | 4 +- .../vins/static_route_access_grant.go | 8 +- .../vins/static_route_access_revoke.go | 8 +- pkg/cloudbroker/vins/static_route_add.go | 8 +- pkg/cloudbroker/vins/static_route_del.go | 8 +- pkg/cloudbroker/vins/static_route_list.go | 8 +- pkg/cloudbroker/vins/vnfdev_redeploy.go | 8 +- pkg/cloudbroker/vins/vnfdev_reset.go | 8 +- pkg/cloudbroker/vins/vnfdev_restart.go | 8 +- pkg/cloudbroker/vins/vnfdev_start.go | 6 +- pkg/cloudbroker/vins/vnfdev_stop.go | 8 +- 639 files changed, 2003 insertions(+), 3217 deletions(-) create mode 100644 internal/multierror/join.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e38182..2a87605 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,20 @@ -## Version 1.6.6 +## Version 1.6.7 ## Bugfix -- Fixed model RecordExtNet in cloudbroker/extnet/models for correct work of get request -- Fixed json tags in ItemResourceConsumption model and delete extra model Consumed in cloudbroker/account/models -- Fixed statelessSepId field type from uint64 to int64 in cloudbroker/compute/models for correct work of list request - -## Feature -- Added GetRaw and ListRaw methods that give response as an array of bytes for cloudAPI groups: account, compute, k8s, disks, rg, bservice, disks,extnet, flipgroup, image, k8ci, lb, locations(list), sizes(list), stack, tasks, vins -- Added GetRaw and ListRaw methods that give response as an array of bytes for cloudbroker groups: account, apiaccess, compute, disks, extnet, flipgroup, grid, group, image, k8ci, k8s, lb, rg, sep, stack, tasks, user, vgpu, vins \ No newline at end of file +- Refactoring client and legacy-client +- Delete tag "required" in RecursiveDelete field model DeleteUserRequest in cloudbroker/account/delete_user +- Delete tag "omitempty" in RecursiveDelete field model DeleteUserRequest in cloudapi/account/delete_user +- Delete tag "required" in Ratio field model SetCPUAllocationRatioRequest in cloudbroker/account/set_cpu_allocation_ratio +- Change tag from "requireD" to "required" in K8SID field model WorkerRestartRequest in cloudbroker/k8s/worker_restart +- Add tag "required" in UserIDs field model DeleteUsersRequest in cloudbroker/users/delete_users +- Change tag "validate" in ComputeID field model SnapshotEvictDiskRequest in cloudbroker/compute/snapshot_evict_disk +- Delete unnecessary validation in ListRaw method in cloudbroker/apiaccess/list +- Delete unnecessary validation in ListDeleted method in cloudbroker/apiaccess/list_deleted +- Delete unnecessary validation in GetAudit method in cloudbroker/user/get_audit +- Delete unnecessary validation in ListRaw method in cloudbroker/user/list +- Delete unnecessary validation in ListTypes method in cloudbroker/disks/list_types +- Delete tag "required" in Active field model ListRequest in cloudbroker/group/list +- Delete unnecessary validation in List method in cloudbroker/group/list +- Change type from "APIsEndpoints" to "APIString" in APIs field in APIsIncludeRequest model in cloudbroker/apiaccess/apis_include +- Change type from "APIsEndpoints" to "APIString" in APIs field in APIsExcludeRequest model in cloudbroker/apiaccess/apis_exclude +- Refactoring multiple errors out put after validation in all cloudapi and cloudbroker groups, in client and legacy-client \ No newline at end of file diff --git a/README.md b/README.md index d27675d..e27d329 100644 --- a/README.md +++ b/README.md @@ -557,7 +557,7 @@ func main() { // Создание клиента client := decort.New(cfg) - // 1. Создание структуры запроса GetRequest на создание аккаунта и выполнение GetRaw запроса с помощью конвейера + // 1. Создание структуры запроса GetRequest на получение информации об аккаунте и выполнение GetRaw запроса с помощью конвейера req1 := account.GetRequest{ AccountID: 123, } @@ -567,7 +567,7 @@ func main() { } fmt.Println(string(res1)) - // 2. Создание структуры запроса ListRequest на получение аккаунтов и выполнение ListRaw запроса с помощью конвейера + // 2. Создание структуры запроса ListRequest на получение информации об аккаунтах и выполнение ListRaw запроса с помощью конвейера req2 := account.ListRequest{} res2, err := client.CloudAPI().Account().ListRaw(context.Background(), req2) if err != nil { diff --git a/client.go b/client.go index 0b3df97..6866709 100644 --- a/client.go +++ b/client.go @@ -14,12 +14,12 @@ import ( "sync" "time" + "github.com/google/go-querystring/query" + "repository.basistech.ru/BASIS/decort-golang-sdk/config" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi" k8s_ca "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker" - k8s_cb"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8s" - "github.com/google/go-querystring/query" - "repository.basistech.ru/BASIS/decort-golang-sdk/config" + k8s_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8s" ) // HTTP-client for platform @@ -73,287 +73,21 @@ func (dc *DecortClient) CloudBroker() *cloudbroker.CloudBroker { func (dc *DecortClient) DecortApiCall(ctx context.Context, method, url string, params interface{}) ([]byte, error) { k8sCaCreateReq, okCa := params.(k8s_ca.CreateRequest) k8sCbCreateReq, okCb := params.(k8s_cb.CreateRequest) + var body *bytes.Buffer + var ctype string if okCa { - reqBody := &bytes.Buffer{} - writer := multipart.NewWriter(reqBody) - if k8sCaCreateReq.OidcCertificate != "" { - part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") - _, _ = io.Copy(part, strings.NewReader(k8sCaCreateReq.OidcCertificate)) - } - - _ = writer.WriteField("name", k8sCaCreateReq.Name) - _ = writer.WriteField("rgId", strconv.FormatUint(k8sCaCreateReq.RGID, 10)) - _ = writer.WriteField("k8ciId", strconv.FormatUint(k8sCaCreateReq.K8SCIID, 10)) - _ = writer.WriteField("workerGroupName", k8sCaCreateReq.WorkerGroupName) - _ = writer.WriteField("networkPlugin", k8sCaCreateReq.NetworkPlugin) - - if k8sCaCreateReq.MasterSEPID != 0 { - _ = writer.WriteField("masterSepId", strconv.FormatUint(k8sCaCreateReq.MasterSEPID, 10)) - } - if k8sCaCreateReq.MasterSEPPool != "" { - _ = writer.WriteField("masterSepPool", k8sCaCreateReq.MasterSEPPool) - } - if k8sCaCreateReq.WorkerSEPID != 0 { - _ = writer.WriteField("workerSepId", strconv.FormatUint(k8sCaCreateReq.WorkerSEPID, 10)) - } - if k8sCaCreateReq.WorkerSEPPool != "" { - _ = writer.WriteField("workerSepPool", k8sCaCreateReq.WorkerSEPPool) - } - - if k8sCaCreateReq.Labels != nil { - for _, v := range k8sCaCreateReq.Labels { - _ = writer.WriteField("labels", v) - } - } - if k8sCaCreateReq.Taints != nil { - for _, v := range k8sCaCreateReq.Taints { - _ = writer.WriteField("taints", v) - } - } - if k8sCaCreateReq.Annotations != nil { - for _, v := range k8sCaCreateReq.Annotations { - _ = writer.WriteField("annotations", v) - } - } - - if k8sCaCreateReq.MasterCPU != 0 { - _ = writer.WriteField("masterCpu", strconv.FormatUint(uint64(k8sCaCreateReq.MasterCPU), 10)) - } - if k8sCaCreateReq.MasterNum != 0 { - _ = writer.WriteField("masterNum", strconv.FormatUint(uint64(k8sCaCreateReq.MasterNum), 10)) - } - if k8sCaCreateReq.MasterRAM != 0 { - _ = writer.WriteField("masterRam", strconv.FormatUint(uint64(k8sCaCreateReq.MasterRAM), 10)) - } - if k8sCaCreateReq.MasterDisk != 0 { - _ = writer.WriteField("masterDisk", strconv.FormatUint(uint64(k8sCaCreateReq.MasterDisk), 10)) - } - if k8sCaCreateReq.WorkerCPU != 0 { - _ = writer.WriteField("workerCpu", strconv.FormatUint(uint64(k8sCaCreateReq.WorkerCPU), 10)) - } - if k8sCaCreateReq.WorkerNum != 0 { - _ = writer.WriteField("workerNum", strconv.FormatUint(uint64(k8sCaCreateReq.WorkerNum), 10)) - } - if k8sCaCreateReq.WorkerRAM != 0 { - _ = writer.WriteField("workerRam", strconv.FormatUint(uint64(k8sCaCreateReq.WorkerRAM), 10)) - } - if k8sCaCreateReq.WorkerDisk != 0 { - _ = writer.WriteField("workerDisk", strconv.FormatUint(uint64(k8sCaCreateReq.WorkerDisk), 10)) - } - if k8sCaCreateReq.ExtNetID != 0 { - _ = writer.WriteField("extnetId", strconv.FormatUint(k8sCaCreateReq.ExtNetID, 10)) - } - if k8sCaCreateReq.VinsId != 0 { - _ = writer.WriteField("vinsId", strconv.FormatUint(k8sCaCreateReq.VinsId, 10)) - } - if !k8sCaCreateReq.WithLB { - _ = writer.WriteField("withLB", strconv.FormatBool(k8sCaCreateReq.WithLB)) - } - - _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(k8sCaCreateReq.HighlyAvailable)) - - if k8sCaCreateReq.AdditionalSANs != nil { - for _, v := range k8sCaCreateReq.AdditionalSANs { - _ = writer.WriteField("additionalSANs", v) - } - } - if k8sCaCreateReq.InitConfiguration != "" { - _ = writer.WriteField("initConfiguration", k8sCaCreateReq.InitConfiguration) - } - if k8sCaCreateReq.ClusterConfiguration != "" { - _ = writer.WriteField("clusterConfiguration", k8sCaCreateReq.ClusterConfiguration) - } - if k8sCaCreateReq.KubeletConfiguration != "" { - _ = writer.WriteField("kubeletConfiguration", k8sCaCreateReq.KubeletConfiguration) - } - if k8sCaCreateReq.KubeProxyConfiguration != "" { - _ = writer.WriteField("kubeProxyConfiguration", k8sCaCreateReq.KubeProxyConfiguration) - } - if k8sCaCreateReq.JoinConfiguration != "" { - _ = writer.WriteField("joinConfiguration", k8sCaCreateReq.JoinConfiguration) - } - if k8sCaCreateReq.Description != "" { - _ = writer.WriteField("desc", k8sCaCreateReq.Description) - } - if k8sCaCreateReq.UserData != "" { - _ = writer.WriteField("userData", k8sCaCreateReq.UserData) - } - - _ = writer.WriteField("extnetOnly", strconv.FormatBool(k8sCaCreateReq.ExtNetOnly)) - _ = writer.FormDataContentType() - - ct := writer.FormDataContentType() - - writer.Close() - req, err := http.NewRequestWithContext(ctx, method, dc.decortURL+"/restmachine"+url, reqBody) - if err != nil { - return nil, err - } - if err = dc.getToken(ctx); err != nil { - return nil, err - } - - resp, err := dc.domp(req, ct) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - respBytes, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - if resp.StatusCode != 200 { - return nil, errors.New(string(respBytes)) - } - - return respBytes, nil + body, ctype = createK8sCloudApi(k8sCaCreateReq) } else if okCb { - reqBody := &bytes.Buffer{} - writer := multipart.NewWriter(reqBody) - if k8sCbCreateReq.OidcCertificate != "" { - part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") - _, _ = io.Copy(part, strings.NewReader(k8sCbCreateReq.OidcCertificate)) - } - - _ = writer.WriteField("name", k8sCbCreateReq.Name) - _ = writer.WriteField("rgId", strconv.FormatUint(k8sCbCreateReq.RGID, 10)) - _ = writer.WriteField("k8ciId", strconv.FormatUint(k8sCbCreateReq.K8CIID, 10)) - _ = writer.WriteField("workerGroupName", k8sCbCreateReq.WorkerGroupName) - _ = writer.WriteField("networkPlugin", k8sCbCreateReq.NetworkPlugin) - - if k8sCbCreateReq.MasterSEPID != 0 { - _ = writer.WriteField("masterSepId", strconv.FormatUint(k8sCbCreateReq.MasterSEPID, 10)) - } - if k8sCbCreateReq.MasterSEPPool != "" { - _ = writer.WriteField("masterSepPool", k8sCbCreateReq.MasterSEPPool) - } - if k8sCbCreateReq.WorkerSEPID != 0 { - _ = writer.WriteField("workerSepId", strconv.FormatUint(k8sCbCreateReq.WorkerSEPID, 10)) - } - if k8sCbCreateReq.WorkerSEPPool != "" { - _ = writer.WriteField("workerSepPool", k8sCbCreateReq.WorkerSEPPool) - } - - if k8sCbCreateReq.Labels != nil { - for _, v := range k8sCbCreateReq.Labels { - _ = writer.WriteField("labels", v) - } - } - if k8sCbCreateReq.Taints != nil { - for _, v := range k8sCbCreateReq.Taints { - _ = writer.WriteField("taints", v) - } - } - if k8sCbCreateReq.Annotations != nil { - for _, v := range k8sCbCreateReq.Annotations { - _ = writer.WriteField("annotations", v) - } - } - - if k8sCbCreateReq.MasterCPU != 0 { - _ = writer.WriteField("masterCpu", strconv.FormatUint(k8sCbCreateReq.MasterCPU, 10)) - } - if k8sCbCreateReq.MasterNum != 0 { - _ = writer.WriteField("masterNum", strconv.FormatUint(k8sCbCreateReq.MasterNum, 10)) - } - if k8sCbCreateReq.MasterRAM != 0 { - _ = writer.WriteField("masterRam", strconv.FormatUint(k8sCbCreateReq.MasterRAM, 10)) - } - if k8sCbCreateReq.MasterDisk != 0 { - _ = writer.WriteField("masterDisk", strconv.FormatUint(k8sCbCreateReq.MasterDisk, 10)) - } - if k8sCbCreateReq.WorkerCPU != 0 { - _ = writer.WriteField("workerCpu", strconv.FormatUint(k8sCbCreateReq.WorkerCPU, 10)) - } - if k8sCbCreateReq.WorkerNum != 0 { - _ = writer.WriteField("workerNum", strconv.FormatUint(k8sCbCreateReq.WorkerNum, 10)) - } - if k8sCbCreateReq.WorkerRAM != 0 { - _ = writer.WriteField("workerRam", strconv.FormatUint(k8sCbCreateReq.WorkerRAM, 10)) - } - if k8sCbCreateReq.WorkerDisk != 0 { - _ = writer.WriteField("workerDisk", strconv.FormatUint(k8sCbCreateReq.WorkerDisk, 10)) - } - if k8sCbCreateReq.ExtNetID != 0 { - _ = writer.WriteField("extnetId", strconv.FormatUint(k8sCbCreateReq.ExtNetID, 10)) - } - if k8sCbCreateReq.VinsId != 0 { - _ = writer.WriteField("vinsId", strconv.FormatUint(k8sCbCreateReq.VinsId, 10)) - } - if !k8sCbCreateReq.WithLB { - _ = writer.WriteField("withLB", strconv.FormatBool(k8sCbCreateReq.WithLB)) - } - - _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(k8sCbCreateReq.HighlyAvailable)) - - if k8sCbCreateReq.AdditionalSANs != nil { - for _, v := range k8sCbCreateReq.AdditionalSANs { - _ = writer.WriteField("additionalSANs", v) - } - } - if k8sCbCreateReq.InitConfiguration != "" { - _ = writer.WriteField("initConfiguration", k8sCbCreateReq.InitConfiguration) - } - if k8sCbCreateReq.ClusterConfiguration != "" { - _ = writer.WriteField("clusterConfiguration", k8sCbCreateReq.ClusterConfiguration) - } - if k8sCbCreateReq.KubeletConfiguration != "" { - _ = writer.WriteField("kubeletConfiguration", k8sCbCreateReq.KubeletConfiguration) - } - if k8sCbCreateReq.KubeProxyConfiguration != "" { - _ = writer.WriteField("kubeProxyConfiguration", k8sCbCreateReq.KubeProxyConfiguration) - } - if k8sCbCreateReq.JoinConfiguration != "" { - _ = writer.WriteField("joinConfiguration", k8sCbCreateReq.JoinConfiguration) - } - if k8sCbCreateReq.Description != "" { - _ = writer.WriteField("desc", k8sCbCreateReq.Description) - } - if k8sCbCreateReq.UserData != "" { - _ = writer.WriteField("userData", k8sCbCreateReq.UserData) - } - - _ = writer.WriteField("extnetOnly", strconv.FormatBool(k8sCbCreateReq.ExtNetOnly)) - _ = writer.FormDataContentType() - - ct := writer.FormDataContentType() - - writer.Close() - req, err := http.NewRequestWithContext(ctx, method, dc.decortURL+"/restmachine"+url, reqBody) + body, ctype = createK8sCloudBroker(k8sCbCreateReq) + } else { + values, err := query.Values(params) if err != nil { return nil, err } - if err = dc.getToken(ctx); err != nil { - return nil, err - } - - resp, err := dc.domp(req, ct) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - respBytes, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - if resp.StatusCode != 200 { - return nil, errors.New(string(respBytes)) - } - - return respBytes, nil - } - - values, err := query.Values(params) - if err != nil { - return nil, err + body = bytes.NewBufferString(values.Encode()) } - body := strings.NewReader(values.Encode()) req, err := http.NewRequestWithContext(ctx, method, dc.decortURL+"/restmachine"+url, body) if err != nil { return nil, err @@ -363,7 +97,7 @@ func (dc *DecortClient) DecortApiCall(ctx context.Context, method, url string, p return nil, err } - resp, err := dc.do(req) + resp, err := dc.do(req, ctype) if err != nil { return nil, err } @@ -415,8 +149,13 @@ func (dc *DecortClient) getToken(ctx context.Context) error { return nil } -func (dc *DecortClient) do(req *http.Request) (*http.Response, error) { - req.Header.Add("Content-Type", "application/x-www-form-urlencoded") +func (dc *DecortClient) do(req *http.Request, ctype string) (*http.Response, error) { + if ctype != "" { + req.Header.Add("Content-Type", ctype) + } else { + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + } + req.Header.Add("Authorization", "bearer "+dc.cfg.Token) req.Header.Set("Accept", "application/json") @@ -442,29 +181,230 @@ func (dc *DecortClient) do(req *http.Request) (*http.Response, error) { return nil, fmt.Errorf("could not execute request: %w", err) } -func (dc *DecortClient) domp(req *http.Request, ctype string) (*http.Response, error) { - req.Header.Add("Content-Type", ctype) - req.Header.Add("Authorization", "bearer "+dc.cfg.Token) - req.Header.Set("Accept", "application/json") +func createK8sCloudApi(req k8s_ca.CreateRequest) (*bytes.Buffer, string) { + reqBody := &bytes.Buffer{} + writer := multipart.NewWriter(reqBody) + if req.OidcCertificate != "" { + part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") + _, _ = io.Copy(part, strings.NewReader(req.OidcCertificate)) + } - // var resp *http.Response - // var err error - buf, _ := io.ReadAll(req.Body) - // req = req.Clone(req.Context()) + _ = writer.WriteField("name", req.Name) + _ = writer.WriteField("rgId", strconv.FormatUint(req.RGID, 10)) + _ = writer.WriteField("k8ciId", strconv.FormatUint(req.K8SCIID, 10)) + _ = writer.WriteField("workerGroupName", req.WorkerGroupName) + _ = writer.WriteField("networkPlugin", req.NetworkPlugin) - // for i := uint64(0); i < dc.cfg.Retries; i++ { - req.Body = io.NopCloser(bytes.NewBuffer(buf)) - resp, err := dc.client.Do(req) + if req.MasterSEPID != 0 { + _ = writer.WriteField("masterSepId", strconv.FormatUint(req.MasterSEPID, 10)) + } + if req.MasterSEPPool != "" { + _ = writer.WriteField("masterSepPool", req.MasterSEPPool) + } + if req.WorkerSEPID != 0 { + _ = writer.WriteField("workerSepId", strconv.FormatUint(req.WorkerSEPID, 10)) + } + if req.WorkerSEPPool != "" { + _ = writer.WriteField("workerSepPool", req.WorkerSEPPool) + } - // if err == nil { - if resp.StatusCode == 200 { - return resp, err + if req.Labels != nil { + for _, v := range req.Labels { + _ = writer.WriteField("labels", v) + } + } + if req.Taints != nil { + for _, v := range req.Taints { + _ = writer.WriteField("taints", v) + } + } + if req.Annotations != nil { + for _, v := range req.Annotations { + _ = writer.WriteField("annotations", v) + } } - respBytes, _ := io.ReadAll(resp.Body) - err = fmt.Errorf("%s", respBytes) - resp.Body.Close() - // } - // } - return nil, fmt.Errorf("could not execute request: %w", err) + if req.MasterCPU != 0 { + _ = writer.WriteField("masterCpu", strconv.FormatUint(uint64(req.MasterCPU), 10)) + } + if req.MasterNum != 0 { + _ = writer.WriteField("masterNum", strconv.FormatUint(uint64(req.MasterNum), 10)) + } + if req.MasterRAM != 0 { + _ = writer.WriteField("masterRam", strconv.FormatUint(uint64(req.MasterRAM), 10)) + } + if req.MasterDisk != 0 { + _ = writer.WriteField("masterDisk", strconv.FormatUint(uint64(req.MasterDisk), 10)) + } + if req.WorkerCPU != 0 { + _ = writer.WriteField("workerCpu", strconv.FormatUint(uint64(req.WorkerCPU), 10)) + } + if req.WorkerNum != 0 { + _ = writer.WriteField("workerNum", strconv.FormatUint(uint64(req.WorkerNum), 10)) + } + if req.WorkerRAM != 0 { + _ = writer.WriteField("workerRam", strconv.FormatUint(uint64(req.WorkerRAM), 10)) + } + if req.WorkerDisk != 0 { + _ = writer.WriteField("workerDisk", strconv.FormatUint(uint64(req.WorkerDisk), 10)) + } + if req.ExtNetID != 0 { + _ = writer.WriteField("extnetId", strconv.FormatUint(req.ExtNetID, 10)) + } + if req.VinsId != 0 { + _ = writer.WriteField("vinsId", strconv.FormatUint(req.VinsId, 10)) + } + if !req.WithLB { + _ = writer.WriteField("withLB", strconv.FormatBool(req.WithLB)) + } + + _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(req.HighlyAvailable)) + + if req.AdditionalSANs != nil { + for _, v := range req.AdditionalSANs { + _ = writer.WriteField("additionalSANs", v) + } + } + if req.InitConfiguration != "" { + _ = writer.WriteField("initConfiguration", req.InitConfiguration) + } + if req.ClusterConfiguration != "" { + _ = writer.WriteField("clusterConfiguration", req.ClusterConfiguration) + } + if req.KubeletConfiguration != "" { + _ = writer.WriteField("kubeletConfiguration", req.KubeletConfiguration) + } + if req.KubeProxyConfiguration != "" { + _ = writer.WriteField("kubeProxyConfiguration", req.KubeProxyConfiguration) + } + if req.JoinConfiguration != "" { + _ = writer.WriteField("joinConfiguration", req.JoinConfiguration) + } + if req.Description != "" { + _ = writer.WriteField("desc", req.Description) + } + if req.UserData != "" { + _ = writer.WriteField("userData", req.UserData) + } + + _ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly)) + + ct := writer.FormDataContentType() + writer.Close() + + return reqBody, ct +} + +func createK8sCloudBroker(req k8s_cb.CreateRequest) (*bytes.Buffer, string) { + reqBody := &bytes.Buffer{} + writer := multipart.NewWriter(reqBody) + if req.OidcCertificate != "" { + part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") + _, _ = io.Copy(part, strings.NewReader(req.OidcCertificate)) + } + + _ = writer.WriteField("name", req.Name) + _ = writer.WriteField("rgId", strconv.FormatUint(req.RGID, 10)) + _ = writer.WriteField("k8ciId", strconv.FormatUint(req.K8CIID, 10)) + _ = writer.WriteField("workerGroupName", req.WorkerGroupName) + _ = writer.WriteField("networkPlugin", req.NetworkPlugin) + + if req.MasterSEPID != 0 { + _ = writer.WriteField("masterSepId", strconv.FormatUint(req.MasterSEPID, 10)) + } + if req.MasterSEPPool != "" { + _ = writer.WriteField("masterSepPool", req.MasterSEPPool) + } + if req.WorkerSEPID != 0 { + _ = writer.WriteField("workerSepId", strconv.FormatUint(req.WorkerSEPID, 10)) + } + if req.WorkerSEPPool != "" { + _ = writer.WriteField("workerSepPool", req.WorkerSEPPool) + } + + if req.Labels != nil { + for _, v := range req.Labels { + _ = writer.WriteField("labels", v) + } + } + if req.Taints != nil { + for _, v := range req.Taints { + _ = writer.WriteField("taints", v) + } + } + if req.Annotations != nil { + for _, v := range req.Annotations { + _ = writer.WriteField("annotations", v) + } + } + + if req.MasterCPU != 0 { + _ = writer.WriteField("masterCpu", strconv.FormatUint(req.MasterCPU, 10)) + } + if req.MasterNum != 0 { + _ = writer.WriteField("masterNum", strconv.FormatUint(req.MasterNum, 10)) + } + if req.MasterRAM != 0 { + _ = writer.WriteField("masterRam", strconv.FormatUint(req.MasterRAM, 10)) + } + if req.MasterDisk != 0 { + _ = writer.WriteField("masterDisk", strconv.FormatUint(req.MasterDisk, 10)) + } + if req.WorkerCPU != 0 { + _ = writer.WriteField("workerCpu", strconv.FormatUint(req.WorkerCPU, 10)) + } + if req.WorkerNum != 0 { + _ = writer.WriteField("workerNum", strconv.FormatUint(req.WorkerNum, 10)) + } + if req.WorkerRAM != 0 { + _ = writer.WriteField("workerRam", strconv.FormatUint(req.WorkerRAM, 10)) + } + if req.WorkerDisk != 0 { + _ = writer.WriteField("workerDisk", strconv.FormatUint(req.WorkerDisk, 10)) + } + if req.ExtNetID != 0 { + _ = writer.WriteField("extnetId", strconv.FormatUint(req.ExtNetID, 10)) + } + if req.VinsId != 0 { + _ = writer.WriteField("vinsId", strconv.FormatUint(req.VinsId, 10)) + } + if !req.WithLB { + _ = writer.WriteField("withLB", strconv.FormatBool(req.WithLB)) + } + + _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(req.HighlyAvailable)) + + if req.AdditionalSANs != nil { + for _, v := range req.AdditionalSANs { + _ = writer.WriteField("additionalSANs", v) + } + } + if req.InitConfiguration != "" { + _ = writer.WriteField("initConfiguration", req.InitConfiguration) + } + if req.ClusterConfiguration != "" { + _ = writer.WriteField("clusterConfiguration", req.ClusterConfiguration) + } + if req.KubeletConfiguration != "" { + _ = writer.WriteField("kubeletConfiguration", req.KubeletConfiguration) + } + if req.KubeProxyConfiguration != "" { + _ = writer.WriteField("kubeProxyConfiguration", req.KubeProxyConfiguration) + } + if req.JoinConfiguration != "" { + _ = writer.WriteField("joinConfiguration", req.JoinConfiguration) + } + if req.Description != "" { + _ = writer.WriteField("desc", req.Description) + } + if req.UserData != "" { + _ = writer.WriteField("userData", req.UserData) + } + + _ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly)) + + ct := writer.FormDataContentType() + + writer.Close() + return reqBody, ct } diff --git a/config/config.go b/config/config.go index d6847ae..9193de1 100644 --- a/config/config.go +++ b/config/config.go @@ -72,9 +72,7 @@ func ParseConfigJSON(path string) (Config, error) { err = validators.ValidateConfig(config) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return Config{}, validators.ValidationError(validationError) - } + return Config{}, validators.ValidationErrors(validators.GetErrors(err)) } return config, nil @@ -96,9 +94,7 @@ func ParseConfigYAML(path string) (Config, error) { err = validators.ValidateConfig(config) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return Config{}, validators.ValidationError(validationError) - } + return Config{}, validators.ValidationErrors(validators.GetErrors(err)) } return config, nil diff --git a/config/legacy-config.go b/config/legacy-config.go index a3a7a09..0bc8159 100644 --- a/config/legacy-config.go +++ b/config/legacy-config.go @@ -66,9 +66,7 @@ func ParseLegacyConfigJSON(path string) (LegacyConfig, error) { err = validators.ValidateConfig(config) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return LegacyConfig{}, validators.ValidationError(validationError) - } + return LegacyConfig{}, validators.ValidationErrors(validators.GetErrors(err)) } return config, nil @@ -90,9 +88,7 @@ func ParseLegacyConfigYAML(path string) (LegacyConfig, error) { err = validators.ValidateConfig(config) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return LegacyConfig{}, validators.ValidationError(validationError) - } + return LegacyConfig{}, validators.ValidationErrors(validators.GetErrors(err)) } return config, nil diff --git a/internal/multierror/join.go b/internal/multierror/join.go new file mode 100644 index 0000000..e5afca3 --- /dev/null +++ b/internal/multierror/join.go @@ -0,0 +1,41 @@ +package multierror + +func Join(errs ...error) error { + n := 0 + for _, err := range errs { + if err != nil { + n++ + } + } + if n == 0 { + return nil + } + e := &joinError{ + errs: make([]error, 0, n), + } + for _, err := range errs { + if err != nil { + e.errs = append(e.errs, err) + } + } + return e +} + +type joinError struct { + errs []error +} + +func (e *joinError) Error() string { + var b []byte + for i, err := range e.errs { + if i > 0 { + b = append(b, '\n') + } + b = append(b, err.Error()...) + } + return string(b) +} + +func (e *joinError) Unwrap() []error { + return e.errs +} diff --git a/internal/validators/helper.go b/internal/validators/helper.go index 6a2f7ed..72251cf 100644 --- a/internal/validators/helper.go +++ b/internal/validators/helper.go @@ -2,6 +2,7 @@ package validators import ( "errors" + "repository.basistech.ru/BASIS/decort-golang-sdk/internal/multierror" "github.com/go-playground/validator/v10" ) @@ -20,6 +21,14 @@ func ValidationError(fe validator.FieldError) error { return errors.New(errorMessage(fe)) } +func ValidationErrors(fes []validator.FieldError) error { + errs := make([]error, 0, len(fes)) + for _, fe := range fes { + errs = append(errs, ValidationError(fe)) + } + return multierror.Join(errs...) +} + //nolint:errorlint func GetErrors(err error) validator.ValidationErrors { return err.(validator.ValidationErrors) diff --git a/legacy-client.go b/legacy-client.go index f2f4f5e..df408b4 100644 --- a/legacy-client.go +++ b/legacy-client.go @@ -18,8 +18,9 @@ import ( "github.com/google/go-querystring/query" "repository.basistech.ru/BASIS/decort-golang-sdk/config" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s" + k8s_ca "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker" + k8s_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8s" ) // Legacy HTTP-client for platform @@ -71,165 +72,34 @@ func (ldc *LegacyDecortClient) CloudBroker() *cloudbroker.CloudBroker { // DecortApiCall method for sending requests to the platform func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url string, params interface{}) ([]byte, error) { - if k8sCreateReq, ok := params.(k8s.CreateRequest); ok { - reqBody := &bytes.Buffer{} - writer := multipart.NewWriter(reqBody) - if k8sCreateReq.OidcCertificate != "" { - part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") - _, _ = io.Copy(part, strings.NewReader(k8sCreateReq.OidcCertificate)) - } - - _ = writer.WriteField("name", k8sCreateReq.Name) - _ = writer.WriteField("rgId", strconv.FormatUint(k8sCreateReq.RGID, 10)) - _ = writer.WriteField("k8ciId", strconv.FormatUint(k8sCreateReq.K8SCIID, 10)) - _ = writer.WriteField("workerGroupName", k8sCreateReq.WorkerGroupName) - _ = writer.WriteField("networkPlugin", k8sCreateReq.NetworkPlugin) - - if k8sCreateReq.MasterSEPID != 0 { - _ = writer.WriteField("masterSepId", strconv.FormatUint(k8sCreateReq.MasterSEPID, 10)) - } - if k8sCreateReq.MasterSEPPool != "" { - _ = writer.WriteField("masterSepPool", k8sCreateReq.MasterSEPPool) - } - if k8sCreateReq.WorkerSEPID != 0 { - _ = writer.WriteField("workerSepId", strconv.FormatUint(k8sCreateReq.WorkerSEPID, 10)) - } - if k8sCreateReq.WorkerSEPPool != "" { - _ = writer.WriteField("workerSepPool", k8sCreateReq.WorkerSEPPool) - } - - if k8sCreateReq.Labels != nil { - for _, v := range k8sCreateReq.Labels { - _ = writer.WriteField("labels", v) - } - } - if k8sCreateReq.Taints != nil { - for _, v := range k8sCreateReq.Taints { - _ = writer.WriteField("taints", v) - } - } - if k8sCreateReq.Annotations != nil { - for _, v := range k8sCreateReq.Annotations { - _ = writer.WriteField("annotations", v) - } - } - - if k8sCreateReq.MasterCPU != 0 { - _ = writer.WriteField("masterCpu", strconv.FormatUint(uint64(k8sCreateReq.MasterCPU), 10)) - } - if k8sCreateReq.MasterNum != 0 { - _ = writer.WriteField("masterNum", strconv.FormatUint(uint64(k8sCreateReq.MasterNum), 10)) - } - if k8sCreateReq.MasterRAM != 0 { - _ = writer.WriteField("masterRam", strconv.FormatUint(uint64(k8sCreateReq.MasterRAM), 10)) - } - if k8sCreateReq.MasterDisk != 0 { - _ = writer.WriteField("masterDisk", strconv.FormatUint(uint64(k8sCreateReq.MasterDisk), 10)) - } - if k8sCreateReq.WorkerCPU != 0 { - _ = writer.WriteField("workerCpu", strconv.FormatUint(uint64(k8sCreateReq.WorkerCPU), 10)) - } - if k8sCreateReq.WorkerNum != 0 { - _ = writer.WriteField("workerNum", strconv.FormatUint(uint64(k8sCreateReq.WorkerNum), 10)) - } - if k8sCreateReq.WorkerRAM != 0 { - _ = writer.WriteField("workerRam", strconv.FormatUint(uint64(k8sCreateReq.WorkerRAM), 10)) - } - if k8sCreateReq.WorkerDisk != 0 { - _ = writer.WriteField("workerDisk", strconv.FormatUint(uint64(k8sCreateReq.WorkerDisk), 10)) - } - if k8sCreateReq.ExtNetID != 0 { - _ = writer.WriteField("extnetId", strconv.FormatUint(k8sCreateReq.ExtNetID, 10)) - } - if k8sCreateReq.VinsId != 0 { - _ = writer.WriteField("vinsId", strconv.FormatUint(k8sCreateReq.VinsId, 10)) - } - if !k8sCreateReq.WithLB { - _ = writer.WriteField("withLB", strconv.FormatBool(k8sCreateReq.WithLB)) - } - - _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(k8sCreateReq.HighlyAvailable)) - - if k8sCreateReq.AdditionalSANs != nil { - for _, v := range k8sCreateReq.AdditionalSANs { - _ = writer.WriteField("additionalSANs", v) - } - } - if k8sCreateReq.InitConfiguration != "" { - _ = writer.WriteField("initConfiguration", k8sCreateReq.InitConfiguration) - } - if k8sCreateReq.ClusterConfiguration != "" { - _ = writer.WriteField("clusterConfiguration", k8sCreateReq.ClusterConfiguration) - } - if k8sCreateReq.KubeletConfiguration != "" { - _ = writer.WriteField("kubeletConfiguration", k8sCreateReq.KubeletConfiguration) - } - if k8sCreateReq.KubeProxyConfiguration != "" { - _ = writer.WriteField("kubeProxyConfiguration", k8sCreateReq.KubeProxyConfiguration) - } - if k8sCreateReq.JoinConfiguration != "" { - _ = writer.WriteField("joinConfiguration", k8sCreateReq.JoinConfiguration) - } - if k8sCreateReq.Description != "" { - _ = writer.WriteField("desc", k8sCreateReq.Description) - } - if k8sCreateReq.UserData != "" { - _ = writer.WriteField("userData", k8sCreateReq.UserData) - } - - _ = writer.WriteField("extnetOnly", strconv.FormatBool(k8sCreateReq.ExtNetOnly)) - _ = writer.FormDataContentType() - - ct := writer.FormDataContentType() - - if err := ldc.getToken(ctx); err != nil { - return nil, err - } - - _ = writer.WriteField("authkey", ldc.cfg.Token) - - writer.Close() - - req, err := http.NewRequestWithContext(ctx, method, ldc.decortURL+"/restmachine"+url, reqBody) - if err != nil { - return nil, err - } - - resp, err := ldc.domp(req, ct) - if err != nil { - return nil, err - } - defer resp.Body.Close() + if err := ldc.getToken(ctx); err != nil { + return nil, err + } - respBytes, err := io.ReadAll(resp.Body) + k8sCaCreateReq, okCa := params.(k8s_ca.CreateRequest) + k8sCbCreateReq, okCb := params.(k8s_cb.CreateRequest) + + var body *bytes.Buffer + var ctype string + + if okCa { + body, ctype = createK8sCloudApiLegacy(k8sCaCreateReq, ldc.cfg.Token) + } else if okCb { + body, ctype = createK8sCloudBrokerLegacy(k8sCbCreateReq, ldc.cfg.Token) + } else { + values, err := query.Values(params) if err != nil { return nil, err } - - if resp.StatusCode != 200 { - return nil, errors.New(string(respBytes)) - } - - return respBytes, nil - } - - values, err := query.Values(params) - if err != nil { - return nil, err - } - - if err = ldc.getToken(ctx); err != nil { - return nil, err + body = bytes.NewBufferString(values.Encode() + fmt.Sprintf("&authkey=%s", ldc.cfg.Token)) } - - body := strings.NewReader(values.Encode() + fmt.Sprintf("&authkey=%s", ldc.cfg.Token)) - + req, err := http.NewRequestWithContext(ctx, method, ldc.decortURL+"/restmachine"+url, body) if err != nil { return nil, err } - resp, err := ldc.do(req) + resp, err := ldc.do(req, ctype) if err != nil { return nil, err } @@ -278,8 +148,12 @@ func (ldc *LegacyDecortClient) getToken(ctx context.Context) error { return nil } -func (ldc *LegacyDecortClient) do(req *http.Request) (*http.Response, error) { - req.Header.Add("Content-Type", "application/x-www-form-urlencoded") +func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) (*http.Response, error) { + if ctype != "" { + req.Header.Add("Content-Type", ctype) + } else { + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + } req.Header.Set("Accept", "application/json") // var resp *http.Response @@ -305,29 +179,234 @@ func (ldc *LegacyDecortClient) do(req *http.Request) (*http.Response, error) { return nil, fmt.Errorf("could not execute request: %w", err) } -func (ldc *LegacyDecortClient) domp(req *http.Request, ctype string) (*http.Response, error) { - req.Header.Add("Content-Type", ctype) - req.Header.Add("Authorization", "bearer "+ldc.cfg.Token) - req.Header.Set("Accept", "application/json") +func createK8sCloudApiLegacy(req k8s_ca.CreateRequest, token string) (*bytes.Buffer, string) { + reqBody := &bytes.Buffer{} + writer := multipart.NewWriter(reqBody) + if req.OidcCertificate != "" { + part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") + _, _ = io.Copy(part, strings.NewReader(req.OidcCertificate)) + } - // var resp *http.Response - // var err error - buf, _ := io.ReadAll(req.Body) - // req = req.Clone(req.Context()) + _ = writer.WriteField("name", req.Name) + _ = writer.WriteField("rgId", strconv.FormatUint(req.RGID, 10)) + _ = writer.WriteField("k8ciId", strconv.FormatUint(req.K8SCIID, 10)) + _ = writer.WriteField("workerGroupName", req.WorkerGroupName) + _ = writer.WriteField("networkPlugin", req.NetworkPlugin) - // for i := uint64(0); i < ldc.cfg.Retries; i++ { - req.Body = io.NopCloser(bytes.NewBuffer(buf)) - resp, err := ldc.client.Do(req) + if req.MasterSEPID != 0 { + _ = writer.WriteField("masterSepId", strconv.FormatUint(req.MasterSEPID, 10)) + } + if req.MasterSEPPool != "" { + _ = writer.WriteField("masterSepPool", req.MasterSEPPool) + } + if req.WorkerSEPID != 0 { + _ = writer.WriteField("workerSepId", strconv.FormatUint(req.WorkerSEPID, 10)) + } + if req.WorkerSEPPool != "" { + _ = writer.WriteField("workerSepPool", req.WorkerSEPPool) + } - // if err == nil { - if resp.StatusCode == 200 { - return resp, err + if req.Labels != nil { + for _, v := range req.Labels { + _ = writer.WriteField("labels", v) + } + } + if req.Taints != nil { + for _, v := range req.Taints { + _ = writer.WriteField("taints", v) + } + } + if req.Annotations != nil { + for _, v := range req.Annotations { + _ = writer.WriteField("annotations", v) + } } - respBytes, _ := io.ReadAll(resp.Body) - err = fmt.Errorf("%s", respBytes) - resp.Body.Close() - // } - // } - return nil, fmt.Errorf("could not execute request: %w", err) + if req.MasterCPU != 0 { + _ = writer.WriteField("masterCpu", strconv.FormatUint(uint64(req.MasterCPU), 10)) + } + if req.MasterNum != 0 { + _ = writer.WriteField("masterNum", strconv.FormatUint(uint64(req.MasterNum), 10)) + } + if req.MasterRAM != 0 { + _ = writer.WriteField("masterRam", strconv.FormatUint(uint64(req.MasterRAM), 10)) + } + if req.MasterDisk != 0 { + _ = writer.WriteField("masterDisk", strconv.FormatUint(uint64(req.MasterDisk), 10)) + } + if req.WorkerCPU != 0 { + _ = writer.WriteField("workerCpu", strconv.FormatUint(uint64(req.WorkerCPU), 10)) + } + if req.WorkerNum != 0 { + _ = writer.WriteField("workerNum", strconv.FormatUint(uint64(req.WorkerNum), 10)) + } + if req.WorkerRAM != 0 { + _ = writer.WriteField("workerRam", strconv.FormatUint(uint64(req.WorkerRAM), 10)) + } + if req.WorkerDisk != 0 { + _ = writer.WriteField("workerDisk", strconv.FormatUint(uint64(req.WorkerDisk), 10)) + } + if req.ExtNetID != 0 { + _ = writer.WriteField("extnetId", strconv.FormatUint(req.ExtNetID, 10)) + } + if req.VinsId != 0 { + _ = writer.WriteField("vinsId", strconv.FormatUint(req.VinsId, 10)) + } + if !req.WithLB { + _ = writer.WriteField("withLB", strconv.FormatBool(req.WithLB)) + } + + _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(req.HighlyAvailable)) + + if req.AdditionalSANs != nil { + for _, v := range req.AdditionalSANs { + _ = writer.WriteField("additionalSANs", v) + } + } + if req.InitConfiguration != "" { + _ = writer.WriteField("initConfiguration", req.InitConfiguration) + } + if req.ClusterConfiguration != "" { + _ = writer.WriteField("clusterConfiguration", req.ClusterConfiguration) + } + if req.KubeletConfiguration != "" { + _ = writer.WriteField("kubeletConfiguration", req.KubeletConfiguration) + } + if req.KubeProxyConfiguration != "" { + _ = writer.WriteField("kubeProxyConfiguration", req.KubeProxyConfiguration) + } + if req.JoinConfiguration != "" { + _ = writer.WriteField("joinConfiguration", req.JoinConfiguration) + } + if req.Description != "" { + _ = writer.WriteField("desc", req.Description) + } + if req.UserData != "" { + _ = writer.WriteField("userData", req.UserData) + } + + _ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly)) + + _ = writer.WriteField("authkey", token) + + ct := writer.FormDataContentType() + writer.Close() + + return reqBody, ct +} + +func createK8sCloudBrokerLegacy(req k8s_cb.CreateRequest, token string) (*bytes.Buffer, string) { + reqBody := &bytes.Buffer{} + writer := multipart.NewWriter(reqBody) + if req.OidcCertificate != "" { + part, _ := writer.CreateFormFile("oidcCertificate", "ca.crt") + _, _ = io.Copy(part, strings.NewReader(req.OidcCertificate)) + } + + _ = writer.WriteField("name", req.Name) + _ = writer.WriteField("rgId", strconv.FormatUint(req.RGID, 10)) + _ = writer.WriteField("k8ciId", strconv.FormatUint(req.K8CIID, 10)) + _ = writer.WriteField("workerGroupName", req.WorkerGroupName) + _ = writer.WriteField("networkPlugin", req.NetworkPlugin) + + if req.MasterSEPID != 0 { + _ = writer.WriteField("masterSepId", strconv.FormatUint(req.MasterSEPID, 10)) + } + if req.MasterSEPPool != "" { + _ = writer.WriteField("masterSepPool", req.MasterSEPPool) + } + if req.WorkerSEPID != 0 { + _ = writer.WriteField("workerSepId", strconv.FormatUint(req.WorkerSEPID, 10)) + } + if req.WorkerSEPPool != "" { + _ = writer.WriteField("workerSepPool", req.WorkerSEPPool) + } + + if req.Labels != nil { + for _, v := range req.Labels { + _ = writer.WriteField("labels", v) + } + } + if req.Taints != nil { + for _, v := range req.Taints { + _ = writer.WriteField("taints", v) + } + } + if req.Annotations != nil { + for _, v := range req.Annotations { + _ = writer.WriteField("annotations", v) + } + } + + if req.MasterCPU != 0 { + _ = writer.WriteField("masterCpu", strconv.FormatUint(req.MasterCPU, 10)) + } + if req.MasterNum != 0 { + _ = writer.WriteField("masterNum", strconv.FormatUint(req.MasterNum, 10)) + } + if req.MasterRAM != 0 { + _ = writer.WriteField("masterRam", strconv.FormatUint(req.MasterRAM, 10)) + } + if req.MasterDisk != 0 { + _ = writer.WriteField("masterDisk", strconv.FormatUint(req.MasterDisk, 10)) + } + if req.WorkerCPU != 0 { + _ = writer.WriteField("workerCpu", strconv.FormatUint(req.WorkerCPU, 10)) + } + if req.WorkerNum != 0 { + _ = writer.WriteField("workerNum", strconv.FormatUint(req.WorkerNum, 10)) + } + if req.WorkerRAM != 0 { + _ = writer.WriteField("workerRam", strconv.FormatUint(req.WorkerRAM, 10)) + } + if req.WorkerDisk != 0 { + _ = writer.WriteField("workerDisk", strconv.FormatUint(req.WorkerDisk, 10)) + } + if req.ExtNetID != 0 { + _ = writer.WriteField("extnetId", strconv.FormatUint(req.ExtNetID, 10)) + } + if req.VinsId != 0 { + _ = writer.WriteField("vinsId", strconv.FormatUint(req.VinsId, 10)) + } + if !req.WithLB { + _ = writer.WriteField("withLB", strconv.FormatBool(req.WithLB)) + } + + _ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(req.HighlyAvailable)) + + if req.AdditionalSANs != nil { + for _, v := range req.AdditionalSANs { + _ = writer.WriteField("additionalSANs", v) + } + } + if req.InitConfiguration != "" { + _ = writer.WriteField("initConfiguration", req.InitConfiguration) + } + if req.ClusterConfiguration != "" { + _ = writer.WriteField("clusterConfiguration", req.ClusterConfiguration) + } + if req.KubeletConfiguration != "" { + _ = writer.WriteField("kubeletConfiguration", req.KubeletConfiguration) + } + if req.KubeProxyConfiguration != "" { + _ = writer.WriteField("kubeProxyConfiguration", req.KubeProxyConfiguration) + } + if req.JoinConfiguration != "" { + _ = writer.WriteField("joinConfiguration", req.JoinConfiguration) + } + if req.Description != "" { + _ = writer.WriteField("desc", req.Description) + } + if req.UserData != "" { + _ = writer.WriteField("userData", req.UserData) + } + + _ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly)) + + _ = writer.WriteField("authkey", token) + + ct := writer.FormDataContentType() + + writer.Close() + return reqBody, ct } diff --git a/pkg/cloudapi/account/add_user.go b/pkg/cloudapi/account/add_user.go index 00b10fb..9f3ae16 100644 --- a/pkg/cloudapi/account/add_user.go +++ b/pkg/cloudapi/account/add_user.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for adding permission to access to account for a user +// AddUserRequest struct to add permission to access account for a user type AddUserRequest struct { // ID of account to add to // Required: true @@ -30,9 +30,7 @@ type AddUserRequest struct { func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/addUser" diff --git a/pkg/cloudapi/account/audits.go b/pkg/cloudapi/account/audits.go index 9367368..267a656 100644 --- a/pkg/cloudapi/account/audits.go +++ b/pkg/cloudapi/account/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for give list account audits +// AuditsRequest struct to give list of account audits type AuditsRequest struct { // ID of the account // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (a Account) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/audits" diff --git a/pkg/cloudapi/account/create.go b/pkg/cloudapi/account/create.go index cfb3405..6885de4 100644 --- a/pkg/cloudapi/account/create.go +++ b/pkg/cloudapi/account/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for creating account +// CreateRequest struct for creating account type CreateRequest struct { // Display name // Required: true @@ -56,9 +56,7 @@ type CreateRequest struct { func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/create" diff --git a/pkg/cloudapi/account/delete.go b/pkg/cloudapi/account/delete.go index 7e712be..e543b2c 100644 --- a/pkg/cloudapi/account/delete.go +++ b/pkg/cloudapi/account/delete.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete account +// DeleteRequest struct to delete account type DeleteRequest struct { // ID of account to delete // Required: true @@ -22,9 +22,7 @@ type DeleteRequest struct { func (a Account) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/delete" diff --git a/pkg/cloudapi/account/delete_user.go b/pkg/cloudapi/account/delete_user.go index 81ebae1..21a78b7 100644 --- a/pkg/cloudapi/account/delete_user.go +++ b/pkg/cloudapi/account/delete_user.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to account +// DeleteUserRequest struct to revoke access to account type DeleteUserRequest struct { // ID of the account // Required: true @@ -20,16 +20,14 @@ type DeleteUserRequest struct { // Recursively revoke access rights from owned cloudspaces and vmachines // Required: false - RecursiveDelete bool `url:"recursivedelete,omitempty" json:"recursivedelete,omitempty"` + RecursiveDelete bool `url:"recursivedelete" json:"recursivedelete"` } // DeleteUser revokes user access from the account func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/deleteUser" diff --git a/pkg/cloudapi/account/disable_enable.go b/pkg/cloudapi/account/disable_enable.go index 9b2f990..3eb98d4 100644 --- a/pkg/cloudapi/account/disable_enable.go +++ b/pkg/cloudapi/account/disable_enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for change status of account +// DisableEnableRequest struct to change status of account type DisableEnableRequest struct { // ID of account // Required: true @@ -19,9 +19,7 @@ type DisableEnableRequest struct { func (a Account) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/disable" @@ -43,9 +41,7 @@ func (a Account) Disable(ctx context.Context, req DisableEnableRequest) (bool, e func (a Account) Enable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/enable" diff --git a/pkg/cloudapi/account/get.go b/pkg/cloudapi/account/get.go index 6910824..5352e09 100644 --- a/pkg/cloudapi/account/get.go +++ b/pkg/cloudapi/account/get.go @@ -37,9 +37,7 @@ func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error func (a Account) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/get" diff --git a/pkg/cloudapi/account/get_consumed_account_units.go b/pkg/cloudapi/account/get_consumed_account_units.go index 23c15fc..7291a46 100644 --- a/pkg/cloudapi/account/get_consumed_account_units.go +++ b/pkg/cloudapi/account/get_consumed_account_units.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for calculate the currently consumed units for all cloudspaces and resource groups in the account +// GetConsumedAccountUnitsRequest struct to calculate the currently consumed units for all cloudspaces and resource groups in the account type GetConsumedAccountUnitsRequest struct { // ID an account // Required: true @@ -25,9 +25,7 @@ type GetConsumedAccountUnitsRequest struct { func (a Account) GetConsumedAccountUnits(ctx context.Context, req GetConsumedAccountUnitsRequest) (*ResourceLimits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/getConsumedAccountUnits" diff --git a/pkg/cloudapi/account/get_consumed_cloud_units_by_type.go b/pkg/cloudapi/account/get_consumed_cloud_units_by_type.go index e09a58d..5280f38 100644 --- a/pkg/cloudapi/account/get_consumed_cloud_units_by_type.go +++ b/pkg/cloudapi/account/get_consumed_cloud_units_by_type.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for calculate the currently consumed cloud units of the specified type for all cloudspaces and resource groups in the account +// GetConsumedCloudUnitsByTypeRequest struct to calculate the currently consumed cloud units of the specified type for all cloudspaces and resource groups in the account type GetConsumedCloudUnitsByTypeRequest struct { // ID an account // Required: true @@ -35,9 +35,7 @@ type GetConsumedCloudUnitsByTypeRequest struct { func (a Account) GetConsumedCloudUnitsByType(ctx context.Context, req GetConsumedCloudUnitsByTypeRequest) (float64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/getConsumedCloudUnitsByType" diff --git a/pkg/cloudapi/account/get_consumption.go b/pkg/cloudapi/account/get_consumption.go index f36ea92..064133a 100644 --- a/pkg/cloudapi/account/get_consumption.go +++ b/pkg/cloudapi/account/get_consumption.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for download the resources tracking files for an account +// GetConsumptionRequest struct to download the resources tracking files for an account type GetConsumptionRequest struct { // ID an account // Required: true @@ -26,9 +26,7 @@ type GetConsumptionRequest struct { func (a Account) GetConsumption(ctx context.Context, req GetConsumptionRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/getConsumption" @@ -46,9 +44,7 @@ func (a Account) GetConsumption(ctx context.Context, req GetConsumptionRequest) func (a Account) GetConsumptionGet(ctx context.Context, req GetConsumptionRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/getConsumption" diff --git a/pkg/cloudapi/account/get_reserved_account_units.go b/pkg/cloudapi/account/get_reserved_account_units.go index c3f9605..d076596 100644 --- a/pkg/cloudapi/account/get_reserved_account_units.go +++ b/pkg/cloudapi/account/get_reserved_account_units.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for calculate the reserved units for all cloudspaces and resource groups in the account +// GetReservedAccountUnitsRequest struct to calculate the reserved units for all cloudspaces and resource groups in the account type GetReservedAccountUnitsRequest struct { // ID an account // Required: true @@ -26,9 +26,7 @@ type GetReservedAccountUnitsRequest struct { func (a Account) GetReservedAccountUnits(ctx context.Context, req GetReservedAccountUnitsRequest) (*ResourceLimits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/getReservedAccountUnits" diff --git a/pkg/cloudapi/account/get_resource_consumption.go b/pkg/cloudapi/account/get_resource_consumption.go index 1102bd2..9fe932a 100644 --- a/pkg/cloudapi/account/get_resource_consumption.go +++ b/pkg/cloudapi/account/get_resource_consumption.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting resource consumption +// GetResourceConsumptionRequest struct to get resource consumption type GetResourceConsumptionRequest struct { // ID an account // Required: true @@ -19,9 +19,7 @@ type GetResourceConsumptionRequest struct { func (a Account) GetResourceConsumption(ctx context.Context, req GetResourceConsumptionRequest) (*RecordResourceConsumption, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/getResourceConsumption" diff --git a/pkg/cloudapi/account/list_computes.go b/pkg/cloudapi/account/list_computes.go index 79926f5..f8e4be0 100644 --- a/pkg/cloudapi/account/list_computes.go +++ b/pkg/cloudapi/account/list_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for a get list compute instances +// ListComputesRequest struct to get a list of compute instances type ListComputesRequest struct { // ID an account // Required: true @@ -59,9 +59,7 @@ type ListComputesRequest struct { func (a Account) ListComputes(ctx context.Context, req ListComputesRequest) (*ListComputes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/listComputes" diff --git a/pkg/cloudapi/account/list_deleted.go b/pkg/cloudapi/account/list_deleted.go index 4819c8d..18c836c 100644 --- a/pkg/cloudapi/account/list_deleted.go +++ b/pkg/cloudapi/account/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted accounts +// ListDeletedRequest struct to get a list of deleted accounts type ListDeletedRequest struct { // Page number // Required: false @@ -29,7 +29,7 @@ type ListDeletedRequest struct { ACL string `url:"acl,omitempty" json:"acl,omitempty"` } -// ListDeleted gets list all deleted accounts the user has access to +// ListDeleted gets list of all deleted accounts the user has access to func (a Account) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListAccounts, error) { url := "/cloudapi/account/listDeleted" diff --git a/pkg/cloudapi/account/list_disks.go b/pkg/cloudapi/account/list_disks.go index 8bc3a47..7936d99 100644 --- a/pkg/cloudapi/account/list_disks.go +++ b/pkg/cloudapi/account/list_disks.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list deleted disks +// ListDisksRequest struct to get a list of deleted disks type ListDisksRequest struct { // ID an account // Required: true @@ -43,9 +43,7 @@ type ListDisksRequest struct { func (a Account) ListDisks(ctx context.Context, req ListDisksRequest) (*ListDisks, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/listDisks" diff --git a/pkg/cloudapi/account/list_flipgroups.go b/pkg/cloudapi/account/list_flipgroups.go index 6e523e9..5653fbf 100644 --- a/pkg/cloudapi/account/list_flipgroups.go +++ b/pkg/cloudapi/account/list_flipgroups.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list FLIPGroups +// ListFLIPGroupsRequest struct to get a list of FLIPGroups type ListFLIPGroupsRequest struct { // ID of the account // Required: true @@ -51,9 +51,7 @@ type ListFLIPGroupsRequest struct { func (a Account) ListFLIPGroups(ctx context.Context, req ListFLIPGroupsRequest) (*ListFLIPGroups, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/listFlipGroups" diff --git a/pkg/cloudapi/account/list_rg.go b/pkg/cloudapi/account/list_rg.go index 1d13fee..5fa767b 100644 --- a/pkg/cloudapi/account/list_rg.go +++ b/pkg/cloudapi/account/list_rg.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list resource groups +// ListRGRequest struct to get a list of resource groups type ListRGRequest struct { // ID an account // Required: true @@ -43,13 +43,11 @@ type ListRGRequest struct { Status string `url:"status,omitempty" json:"status,omitempty"` } -// ListRG gets list all resource groups under specified account, accessible by the user +// ListRG gets list of all resource groups under specified account, accessible by the user func (a Account) ListRG(ctx context.Context, req ListRGRequest) (*ListRG, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/listRG" diff --git a/pkg/cloudapi/account/list_templates.go b/pkg/cloudapi/account/list_templates.go index 4274be4..29fb973 100644 --- a/pkg/cloudapi/account/list_templates.go +++ b/pkg/cloudapi/account/list_templates.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list templates +// ListTemplatesRequest struct to get a list of templates type ListTemplatesRequest struct { // ID an account // Required: true @@ -39,13 +39,11 @@ type ListTemplatesRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListTemplates gets list templates which can be managed by this account +// ListTemplates gets list of templates which can be managed by this account func (a Account) ListTemplates(ctx context.Context, req ListTemplatesRequest) (*ListTemplates, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/listTemplates" diff --git a/pkg/cloudapi/account/list_vins.go b/pkg/cloudapi/account/list_vins.go index 1e3627f..fe07e5e 100644 --- a/pkg/cloudapi/account/list_vins.go +++ b/pkg/cloudapi/account/list_vins.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list VINS +// ListVINSRequest struct to get a list of VINS type ListVINSRequest struct { // ID an account // Required: true @@ -39,13 +39,11 @@ type ListVINSRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListVINS gets list all ViNSes under specified account, accessible by the user +// ListVINS gets list of all ViNSes under specified account, accessible by the user func (a Account) ListVINS(ctx context.Context, req ListVINSRequest) (*ListVINS, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/listVins" diff --git a/pkg/cloudapi/account/restore.go b/pkg/cloudapi/account/restore.go index 2c8db00..d307805 100644 --- a/pkg/cloudapi/account/restore.go +++ b/pkg/cloudapi/account/restore.go @@ -6,7 +6,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore a deleted account +// RestoreRequest struct to restore a deleted account type RestoreRequest struct { // ID an account // Required: true @@ -17,9 +17,7 @@ type RestoreRequest struct { func (a Account) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/restore" diff --git a/pkg/cloudapi/account/update.go b/pkg/cloudapi/account/update.go index 3811e10..223ca62 100644 --- a/pkg/cloudapi/account/update.go +++ b/pkg/cloudapi/account/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for updaate account +// UpdateRequest struct to update account type UpdateRequest struct { // ID an account // Required: true @@ -51,9 +51,7 @@ type UpdateRequest struct { func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/update" diff --git a/pkg/cloudapi/account/update_user.go b/pkg/cloudapi/account/update_user.go index ba523d1..672079e 100644 --- a/pkg/cloudapi/account/update_user.go +++ b/pkg/cloudapi/account/update_user.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update user access rights +// UpdateUserRequest struct to update user access rights type UpdateUserRequest struct { // ID of the account // Required: true @@ -30,9 +30,7 @@ type UpdateUserRequest struct { func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/account/updateUser" diff --git a/pkg/cloudapi/bservice/create.go b/pkg/cloudapi/bservice/create.go index fa2272f..79e8073 100644 --- a/pkg/cloudapi/bservice/create.go +++ b/pkg/cloudapi/bservice/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for BasicService +// CreateRequest struct for BasicService type CreateRequest struct { // Name of the service // Required: true @@ -31,9 +31,7 @@ type CreateRequest struct { func (b BService) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/create" diff --git a/pkg/cloudapi/bservice/delete.go b/pkg/cloudapi/bservice/delete.go index cfc85a2..b9e7d91 100644 --- a/pkg/cloudapi/bservice/delete.go +++ b/pkg/cloudapi/bservice/delete.go @@ -8,11 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete basic service +// DeleteRequest struct to delete basic service type DeleteRequest struct { // ID of the BasicService to be delete // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // If set to False, Basic service will be deleted to recycle bin. Otherwise destroyed immediately // Required: false @@ -23,9 +23,7 @@ type DeleteRequest struct { func (b BService) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/delete" diff --git a/pkg/cloudapi/bservice/disable.go b/pkg/cloudapi/bservice/disable.go index 180a535..f19faf0 100644 --- a/pkg/cloudapi/bservice/disable.go +++ b/pkg/cloudapi/bservice/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable service +// DisableRequest struct for disable service type DisableRequest struct { // ID of the service to disable // Required: true @@ -21,9 +21,7 @@ type DisableRequest struct { func (b BService) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/delete" diff --git a/pkg/cloudapi/bservice/enable.go b/pkg/cloudapi/bservice/enable.go index e0d3ac3..2571fef 100644 --- a/pkg/cloudapi/bservice/enable.go +++ b/pkg/cloudapi/bservice/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable service +// EnableRequest struct to disable service type EnableRequest struct { // ID of the service to enable // Required: true @@ -22,9 +22,7 @@ type EnableRequest struct { func (b BService) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/enable" diff --git a/pkg/cloudapi/bservice/get.go b/pkg/cloudapi/bservice/get.go index 69e4ea6..7b1fd3b 100644 --- a/pkg/cloudapi/bservice/get.go +++ b/pkg/cloudapi/bservice/get.go @@ -36,9 +36,7 @@ func (b BService) Get(ctx context.Context, req GetRequest) (*RecordBasicService, func (b BService) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/get" diff --git a/pkg/cloudapi/bservice/group_add.go b/pkg/cloudapi/bservice/group_add.go index aa0ee41..645c63e 100644 --- a/pkg/cloudapi/bservice/group_add.go +++ b/pkg/cloudapi/bservice/group_add.go @@ -8,42 +8,42 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create new compute group within BasicService +// GroupAddRequest struct to create new compute group within BasicService type GroupAddRequest struct { // ID of the Basic Service to add a group to // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // Name of the Compute Group to add // Required: true - Name string `url:"name" json:"name" validate:"required"` + Name string `url:"name" json:"name" validate:"required"` // Computes number. Defines how many computes must be there in the group // Required: true - Count uint64 `url:"count" json:"count" validate:"required"` + Count uint64 `url:"count" json:"count" validate:"required"` // Compute CPU number. All computes in the group have the same CPU count // Required: true - CPU uint64 `url:"cpu" json:"cpu" validate:"required"` + CPU uint64 `url:"cpu" json:"cpu" validate:"required"` // Compute RAM volume in MB. All computes in the group have the same RAM volume // Required: true - RAM uint64 `url:"ram" json:"ram" validate:"required"` + RAM uint64 `url:"ram" json:"ram" validate:"required"` // Compute boot disk size in GB // Required: true - Disk uint64 `url:"disk" json:"disk" validate:"required"` + Disk uint64 `url:"disk" json:"disk" validate:"required"` // OS image ID to create computes from // Required: true - ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` + ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` // Compute driver // should be one of: // - KVM_X86 // - KVM_PPC // Required: true - Driver string `url:"driver" json:"driver" validate:"driver"` + Driver string `url:"driver" json:"driver" validate:"driver"` // Storage endpoint provider ID // Required: false @@ -80,9 +80,7 @@ type GroupAddRequest struct { func (b BService) GroupAdd(ctx context.Context, req GroupAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupAdd" diff --git a/pkg/cloudapi/bservice/group_compute_remove.go b/pkg/cloudapi/bservice/group_compute_remove.go index 4acb098..f9848ef 100644 --- a/pkg/cloudapi/bservice/group_compute_remove.go +++ b/pkg/cloudapi/bservice/group_compute_remove.go @@ -8,11 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove group compute +// GroupComputeRemoveRequest struct to remove group compute type GroupComputeRemoveRequest struct { // ID of the Basic Service // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // ID of the Compute GROUP // Required: true @@ -27,9 +27,7 @@ type GroupComputeRemoveRequest struct { func (b BService) GroupComputeRemove(ctx context.Context, req GroupComputeRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupComputeRemove" diff --git a/pkg/cloudapi/bservice/group_get.go b/pkg/cloudapi/bservice/group_get.go index bf913dc..3d4a2f3 100644 --- a/pkg/cloudapi/bservice/group_get.go +++ b/pkg/cloudapi/bservice/group_get.go @@ -8,11 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get detailed information about Compute Group +// GroupGetRequest struct to get detailed information about Compute Group type GroupGetRequest struct { // ID of the Basic Service of Compute Group // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // ID of the Compute Group // Required: true @@ -23,9 +23,7 @@ type GroupGetRequest struct { func (b BService) GroupGet(ctx context.Context, req GroupGetRequest) (*RecordGroup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupGet" diff --git a/pkg/cloudapi/bservice/group_parent_add.go b/pkg/cloudapi/bservice/group_parent_add.go index cb4385c..d639657 100644 --- a/pkg/cloudapi/bservice/group_parent_add.go +++ b/pkg/cloudapi/bservice/group_parent_add.go @@ -8,12 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add parent Compute Group relation emove parent Compute Group -// relation to the specified Compute Group +// GroupParentAddRequest struct to add parent Compute Group relation to the specified Compute Group type GroupParentAddRequest struct { // ID of the Basic Service of Compute Group // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // ID of the Compute Group // Required: true @@ -28,9 +27,7 @@ type GroupParentAddRequest struct { func (b BService) GroupParentAdd(ctx context.Context, req GroupParentAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupParentAdd" diff --git a/pkg/cloudapi/bservice/group_parent_remove.go b/pkg/cloudapi/bservice/group_parent_remove.go index 7e4e419..7ecb1a6 100644 --- a/pkg/cloudapi/bservice/group_parent_remove.go +++ b/pkg/cloudapi/bservice/group_parent_remove.go @@ -8,30 +8,28 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove parent Compute Group -// relation to the specified Compute Group +// GroupParentRemoveRequest struct to remove parent Compute Group +// relation from the specified Compute Group type GroupParentRemoveRequest struct { // ID of the Basic Service of Compute Group // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // ID of the Compute Group // Required: true - CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"` + CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"` // ID of the parent Compute Group // to remove from the current Compute Group // Required: true - ParentID uint64 `url:"parentId" json:"parentId" validate:"required"` + ParentID uint64 `url:"parentId" json:"parentId" validate:"required"` } // GroupParentRemove removes parent Compute Group relation to the specified Compute Group func (b BService) GroupParentRemove(ctx context.Context, req GroupParentRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupParentRemove" diff --git a/pkg/cloudapi/bservice/group_remove.go b/pkg/cloudapi/bservice/group_remove.go index c3aa5e0..2cd5a8c 100644 --- a/pkg/cloudapi/bservice/group_remove.go +++ b/pkg/cloudapi/bservice/group_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for destroy the specified Compute Group +// GroupRemoveRequest struct for destroy the specified Compute Group type GroupRemoveRequest struct { // ID of the Basic Service of Compute Group // Required: true @@ -23,9 +23,7 @@ type GroupRemoveRequest struct { func (b BService) GroupRemove(ctx context.Context, req GroupRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupRemove" diff --git a/pkg/cloudapi/bservice/group_resize.go b/pkg/cloudapi/bservice/group_resize.go index 3298a0a..bd3d01b 100644 --- a/pkg/cloudapi/bservice/group_resize.go +++ b/pkg/cloudapi/bservice/group_resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resize the group +// GroupResizeRequest struct to resize the group type GroupResizeRequest struct { // ID of the Basic Service of Compute Group // Required: true @@ -34,9 +34,7 @@ type GroupResizeRequest struct { func (b BService) GroupResize(ctx context.Context, req GroupResizeRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupResize" diff --git a/pkg/cloudapi/bservice/group_start.go b/pkg/cloudapi/bservice/group_start.go index 38c4aed..9e60385 100644 --- a/pkg/cloudapi/bservice/group_start.go +++ b/pkg/cloudapi/bservice/group_start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start the specified Compute Group +// GroupStartRequest struct to start the specified Compute Group type GroupStartRequest struct { // ID of the Basic Service of Compute Group // Required: true @@ -23,9 +23,7 @@ type GroupStartRequest struct { func (b BService) GroupStart(ctx context.Context, req GroupStartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupStart" diff --git a/pkg/cloudapi/bservice/group_stop.go b/pkg/cloudapi/bservice/group_stop.go index eb515b7..e7a5ee9 100644 --- a/pkg/cloudapi/bservice/group_stop.go +++ b/pkg/cloudapi/bservice/group_stop.go @@ -8,15 +8,15 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop the specified Compute Group +// GroupStopRequest struct to stop the specified Compute Group type GroupStopRequest struct { // ID of the Basic Service of Compute Group // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // ID of the Compute Group to stop // Required: true - CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"` + CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"` // Force stop Compute Group // Required: false @@ -27,9 +27,7 @@ type GroupStopRequest struct { func (b BService) GroupStop(ctx context.Context, req GroupStopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupStop" diff --git a/pkg/cloudapi/bservice/group_update.go b/pkg/cloudapi/bservice/group_update.go index 68df830..d2a8d74 100644 --- a/pkg/cloudapi/bservice/group_update.go +++ b/pkg/cloudapi/bservice/group_update.go @@ -8,15 +8,15 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update existing Compute group +// GroupUpdateRequest struct to update existing Compute group type GroupUpdateRequest struct { // ID of the Basic Service of Compute Group // Required: true - ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` + ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` // ID of the Compute Group // Required: true - CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"` + CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"` // Specify non-empty string to update Compute Group name // Required: false @@ -47,9 +47,7 @@ type GroupUpdateRequest struct { func (b BService) GroupUpdate(ctx context.Context, req GroupUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupUpdate" diff --git a/pkg/cloudapi/bservice/group_update_extnet.go b/pkg/cloudapi/bservice/group_update_extnet.go index adcce48..73639d4 100644 --- a/pkg/cloudapi/bservice/group_update_extnet.go +++ b/pkg/cloudapi/bservice/group_update_extnet.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update External Network settings +// GroupUpdateExtNetRequest struct to update External Network settings type GroupUpdateExtNetRequest struct { // ID of the Basic Service of Compute Group // Required: true @@ -27,9 +27,7 @@ type GroupUpdateExtNetRequest struct { func (b BService) GroupUpdateExtNet(ctx context.Context, req GroupUpdateExtNetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupUpdateExtnet" diff --git a/pkg/cloudapi/bservice/group_update_vins.go b/pkg/cloudapi/bservice/group_update_vins.go index 8c2cf02..a196ff4 100644 --- a/pkg/cloudapi/bservice/group_update_vins.go +++ b/pkg/cloudapi/bservice/group_update_vins.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update VINS settings +// GroupUpdateVINSRequest struct to update VINS settings type GroupUpdateVINSRequest struct { // ID of the Basic Service of Compute Group // Required: true @@ -27,9 +27,7 @@ type GroupUpdateVINSRequest struct { func (b BService) GroupUpdateVINS(ctx context.Context, req GroupUpdateVINSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/groupUpdateVins" diff --git a/pkg/cloudapi/bservice/list_deleted.go b/pkg/cloudapi/bservice/list_deleted.go index cf9856e..4375435 100644 --- a/pkg/cloudapi/bservice/list_deleted.go +++ b/pkg/cloudapi/bservice/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list of deleted BasicService instances +// ListDeletedRequest struct to get list of deleted BasicService instances type ListDeletedRequest struct { // ID of the account to query for BasicService instances // Required: false @@ -25,7 +25,7 @@ type ListDeletedRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListDeleted gets list deleted BasicService instances associated with the specified Resource Group +// ListDeleted gets list of deleted BasicService instances associated with the specified Resource Group func (b BService) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListBasicServices, error) { url := "/cloudapi/bservice/listDeleted" diff --git a/pkg/cloudapi/bservice/restore.go b/pkg/cloudapi/bservice/restore.go index 64e36f2..6b13c3b 100644 --- a/pkg/cloudapi/bservice/restore.go +++ b/pkg/cloudapi/bservice/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restores BasicService instance +// RestoreRequest struct to restore BasicService instance type RestoreRequest struct { // ID of the BasicService to be restored // Required: true @@ -19,9 +19,7 @@ type RestoreRequest struct { func (b BService) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/restore" diff --git a/pkg/cloudapi/bservice/snapshot_create.go b/pkg/cloudapi/bservice/snapshot_create.go index 54158c7..babe1af 100644 --- a/pkg/cloudapi/bservice/snapshot_create.go +++ b/pkg/cloudapi/bservice/snapshot_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create snapshot +// SnapshotCreateRequest struct to create snapshot type SnapshotCreateRequest struct { // ID of the Basic Service // Required: true @@ -23,9 +23,7 @@ type SnapshotCreateRequest struct { func (b BService) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/snapshotCreate" diff --git a/pkg/cloudapi/bservice/snapshot_delete.go b/pkg/cloudapi/bservice/snapshot_delete.go index 54944f7..ae81a99 100644 --- a/pkg/cloudapi/bservice/snapshot_delete.go +++ b/pkg/cloudapi/bservice/snapshot_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete snapshot +// SnapshotDeleteRequest struct to delete snapshot type SnapshotDeleteRequest struct { // ID of the Basic Service // Required: true @@ -23,9 +23,7 @@ type SnapshotDeleteRequest struct { func (b BService) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/snapshotDelete" diff --git a/pkg/cloudapi/bservice/snapshot_list.go b/pkg/cloudapi/bservice/snapshot_list.go index af6381e..efeba00 100644 --- a/pkg/cloudapi/bservice/snapshot_list.go +++ b/pkg/cloudapi/bservice/snapshot_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list existing snapshots +// SnapshotListRequest struct to get list of existing snapshots type SnapshotListRequest struct { // ID of the Basic Service // Required: true @@ -19,9 +19,7 @@ type SnapshotListRequest struct { func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest) (ListSnapshots, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/snapshotList" diff --git a/pkg/cloudapi/bservice/snapshot_rollback.go b/pkg/cloudapi/bservice/snapshot_rollback.go index a1fca1b..9b1f8e1 100644 --- a/pkg/cloudapi/bservice/snapshot_rollback.go +++ b/pkg/cloudapi/bservice/snapshot_rollback.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rollback snapshot +// SnapshotRollbackRequest struct to rollback snapshot type SnapshotRollbackRequest struct { // ID of the Basic Service // Required: true @@ -23,9 +23,7 @@ type SnapshotRollbackRequest struct { func (b BService) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/snapshotRollback" diff --git a/pkg/cloudapi/bservice/start.go b/pkg/cloudapi/bservice/start.go index 4bed140..71b8dff 100644 --- a/pkg/cloudapi/bservice/start.go +++ b/pkg/cloudapi/bservice/start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start service +// StartRequest struct to start service type StartRequest struct { // ID of the service to start // Required: true @@ -21,9 +21,7 @@ type StartRequest struct { func (b BService) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/start" diff --git a/pkg/cloudapi/bservice/stop.go b/pkg/cloudapi/bservice/stop.go index b37651c..5eb5c9f 100644 --- a/pkg/cloudapi/bservice/stop.go +++ b/pkg/cloudapi/bservice/stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop service +// StopRequest struct to stop service type StopRequest struct { // ID of the service to stop // Required: true @@ -21,9 +21,7 @@ type StopRequest struct { func (b BService) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/bservice/stop" diff --git a/pkg/cloudapi/compute/affinity_group_check_start.go b/pkg/cloudapi/compute/affinity_group_check_start.go index 74f964a..9f20676 100644 --- a/pkg/cloudapi/compute/affinity_group_check_start.go +++ b/pkg/cloudapi/compute/affinity_group_check_start.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for check all computes with current affinity label can start +// AffinityGroupCheckStartRequest struct to check all computes with current affinity label can start type AffinityGroupCheckStartRequest struct { // ID of the resource group // Required: true @@ -22,9 +22,7 @@ type AffinityGroupCheckStartRequest struct { func (c Compute) AffinityGroupCheckStart(ctx context.Context, req AffinityGroupCheckStartRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityGroupCheckStart" diff --git a/pkg/cloudapi/compute/affinity_label_remove.go b/pkg/cloudapi/compute/affinity_label_remove.go index 58a10bf..dcc4717 100644 --- a/pkg/cloudapi/compute/affinity_label_remove.go +++ b/pkg/cloudapi/compute/affinity_label_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clear affinity label for compute +// AffinityLabelRemoveRequest struct to clear affinity label for compute type AffinityLabelRemoveRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type AffinityLabelRemoveRequest struct { func (c Compute) AffinityLabelRemove(ctx context.Context, req AffinityLabelRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityLabelRemove" diff --git a/pkg/cloudapi/compute/affinity_label_set.go b/pkg/cloudapi/compute/affinity_label_set.go index f30c571..08046d5 100644 --- a/pkg/cloudapi/compute/affinity_label_set.go +++ b/pkg/cloudapi/compute/affinity_label_set.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set affinity label for compute +// AffinityLabelSetRequest struct to set affinity label for compute type AffinityLabelSetRequest struct { // ID of the compute instance // Required: true @@ -23,9 +23,7 @@ type AffinityLabelSetRequest struct { func (c Compute) AffinityLabelSet(ctx context.Context, req AffinityLabelSetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityLabelSet" diff --git a/pkg/cloudapi/compute/affinity_relations.go b/pkg/cloudapi/compute/affinity_relations.go index 46a7b85..617d86c 100644 --- a/pkg/cloudapi/compute/affinity_relations.go +++ b/pkg/cloudapi/compute/affinity_relations.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get dict of computes +// AffinityRelationsRequest struct to get dict of computes type AffinityRelationsRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type AffinityRelationsRequest struct { func (c Compute) AffinityRelations(ctx context.Context, req AffinityRelationsRequest) (*RecordAffinityRelations, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityRelations" diff --git a/pkg/cloudapi/compute/affinity_rule_add.go b/pkg/cloudapi/compute/affinity_rule_add.go index cf1f0a6..7d4de8a 100644 --- a/pkg/cloudapi/compute/affinity_rule_add.go +++ b/pkg/cloudapi/compute/affinity_rule_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add affinity rule +// AffinityRuleAddRequest struct to add affinity rule type AffinityRuleAddRequest struct { // ID of the compute instance // Required: true @@ -46,9 +46,7 @@ type AffinityRuleAddRequest struct { func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityRuleAdd" diff --git a/pkg/cloudapi/compute/affinity_rule_remove.go b/pkg/cloudapi/compute/affinity_rule_remove.go index 74f149e..2a6f8cc 100644 --- a/pkg/cloudapi/compute/affinity_rule_remove.go +++ b/pkg/cloudapi/compute/affinity_rule_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove affinity rule +// AffinityRuleRemoveRequest struct to remove affinity rule type AffinityRuleRemoveRequest struct { // ID of the compute instance // Required: true @@ -46,9 +46,7 @@ type AffinityRuleRemoveRequest struct { func (c Compute) AffinityRuleRemove(ctx context.Context, req AffinityRuleRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityRuleRemove" diff --git a/pkg/cloudapi/compute/affinity_rules_clear.go b/pkg/cloudapi/compute/affinity_rules_clear.go index 64aa042..c5c7801 100644 --- a/pkg/cloudapi/compute/affinity_rules_clear.go +++ b/pkg/cloudapi/compute/affinity_rules_clear.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clear affinity rules +// AffinityRulesClearRequest struct to clear affinity rules type AffinityRulesClearRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type AffinityRulesClearRequest struct { func (c Compute) AffinityRulesClear(ctx context.Context, req AffinityRulesClearRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/affinityRulesClear" diff --git a/pkg/cloudapi/compute/anti_affinity_rule_add.go b/pkg/cloudapi/compute/anti_affinity_rule_add.go index fe11c58..0b46a2c 100644 --- a/pkg/cloudapi/compute/anti_affinity_rule_add.go +++ b/pkg/cloudapi/compute/anti_affinity_rule_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add anti affinity rule +// AntiAffinityRuleAddRequest struct to add anti affinity rule type AntiAffinityRuleAddRequest struct { // ID of the compute instance // Required: true @@ -46,9 +46,7 @@ type AntiAffinityRuleAddRequest struct { func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/antiAffinityRuleAdd" diff --git a/pkg/cloudapi/compute/anti_affinity_rule_remove.go b/pkg/cloudapi/compute/anti_affinity_rule_remove.go index f54cf1d..71a103e 100644 --- a/pkg/cloudapi/compute/anti_affinity_rule_remove.go +++ b/pkg/cloudapi/compute/anti_affinity_rule_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove anti affinity rule +// AntiAffinityRuleRemoveRequest struct to remove anti affinity rule type AntiAffinityRuleRemoveRequest struct { // ID of the compute instance // Required: true @@ -46,9 +46,7 @@ type AntiAffinityRuleRemoveRequest struct { func (c Compute) AntiAffinityRuleRemove(ctx context.Context, req AntiAffinityRuleRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/antiAffinityRuleRemove" diff --git a/pkg/cloudapi/compute/anti_affinity_rules_clear.go b/pkg/cloudapi/compute/anti_affinity_rules_clear.go index 857b2a9..7994646 100644 --- a/pkg/cloudapi/compute/anti_affinity_rules_clear.go +++ b/pkg/cloudapi/compute/anti_affinity_rules_clear.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clear anti affinity rules +// AntiAffinityRulesClearRequest struct to clear anti affinity rules type AntiAffinityRulesClearRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type AntiAffinityRulesClearRequest struct { func (c Compute) AntiAffinityRulesClear(ctx context.Context, req AntiAffinityRulesClearRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/antiAffinityRulesClear" diff --git a/pkg/cloudapi/compute/attach_gpu.go b/pkg/cloudapi/compute/attach_gpu.go index b07eb33..9f16064 100644 --- a/pkg/cloudapi/compute/attach_gpu.go +++ b/pkg/cloudapi/compute/attach_gpu.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for attach GPU for compute +// AttachGPURequest struct to attach GPU for compute type AttachGPURequest struct { // Identifier compute // Required: true @@ -23,9 +23,7 @@ type AttachGPURequest struct { func (c Compute) AttachGPU(ctx context.Context, req AttachGPURequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/attachGpu" diff --git a/pkg/cloudapi/compute/attach_pci_device.go b/pkg/cloudapi/compute/attach_pci_device.go index 19b2305..7802262 100644 --- a/pkg/cloudapi/compute/attach_pci_device.go +++ b/pkg/cloudapi/compute/attach_pci_device.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for atttach PCI device +// AttachPCIDeviceRequest struct to attach PCI device type AttachPCIDeviceRequest struct { // Identifier compute // Required: true @@ -23,9 +23,7 @@ type AttachPCIDeviceRequest struct { func (c Compute) AttachPCIDevice(ctx context.Context, req AttachPCIDeviceRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/attachPciDevice" diff --git a/pkg/cloudapi/compute/audits.go b/pkg/cloudapi/compute/audits.go index 23b9c06..9c42fa7 100644 --- a/pkg/cloudapi/compute/audits.go +++ b/pkg/cloudapi/compute/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get audit records +// AuditsRequest struct to get audit records type AuditsRequest struct { // ID of the compute // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (c Compute) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/audits" diff --git a/pkg/cloudapi/compute/boot_order_get.go b/pkg/cloudapi/compute/boot_order_get.go index e5905e8..bcc9ec8 100644 --- a/pkg/cloudapi/compute/boot_order_get.go +++ b/pkg/cloudapi/compute/boot_order_get.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting boot order +// BootOrderGetRequest struct to get boot order type BootOrderGetRequest struct { // Compute ID // Required: true @@ -18,9 +18,7 @@ type BootOrderGetRequest struct { func (c Compute) BootOrderGet(ctx context.Context, req BootOrderGetRequest) ([]string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/bootOrderGet" diff --git a/pkg/cloudapi/compute/boot_order_set.go b/pkg/cloudapi/compute/boot_order_set.go index 533103d..5d7aec0 100644 --- a/pkg/cloudapi/compute/boot_order_set.go +++ b/pkg/cloudapi/compute/boot_order_set.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for setting boot order +// BootOrderSetRequest struct to set boot order type BootOrderSetRequest struct { // ID of compute instance // Required: true @@ -26,9 +26,7 @@ type BootOrderSetRequest struct { func (c Compute) BootOrderSet(ctx context.Context, req BootOrderSetRequest) ([]string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/bootOrderSet" diff --git a/pkg/cloudapi/compute/cd_eject.go b/pkg/cloudapi/compute/cd_eject.go index 6f0d054..5563a7e 100644 --- a/pkg/cloudapi/compute/cd_eject.go +++ b/pkg/cloudapi/compute/cd_eject.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for eject CD image +// CDEjectRequest struct to eject CD image type CDEjectRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type CDEjectRequest struct { func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/cdEject" diff --git a/pkg/cloudapi/compute/cd_insert.go b/pkg/cloudapi/compute/cd_insert.go index 149e23f..548c4b2 100644 --- a/pkg/cloudapi/compute/cd_insert.go +++ b/pkg/cloudapi/compute/cd_insert.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for insert new CD image +// CDInsertRequest struct to insert new CD image type CDInsertRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type CDInsertRequest struct { func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/cdInsert" diff --git a/pkg/cloudapi/compute/change_link_state.go b/pkg/cloudapi/compute/change_link_state.go index 1fa823d..86c74f0 100644 --- a/pkg/cloudapi/compute/change_link_state.go +++ b/pkg/cloudapi/compute/change_link_state.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request struct for changing link state +// ChangeLinkStateRequest struct to change link state type ChangeLinkStateRequest struct { // Compute ID // Required: true @@ -27,9 +27,7 @@ type ChangeLinkStateRequest struct { func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/changeLinkState" diff --git a/pkg/cloudapi/compute/clone.go b/pkg/cloudapi/compute/clone.go index 955c4a4..f6612f0 100644 --- a/pkg/cloudapi/compute/clone.go +++ b/pkg/cloudapi/compute/clone.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clone compute instance +// CloneRequest struct to clone compute instance type CloneRequest struct { // ID of compute instance // Required: true @@ -31,9 +31,7 @@ type CloneRequest struct { func (c Compute) Clone(ctx context.Context, req CloneRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/clone" diff --git a/pkg/cloudapi/compute/create_template.go b/pkg/cloudapi/compute/create_template.go index 1e5cc0d..9d575d9 100644 --- a/pkg/cloudapi/compute/create_template.go +++ b/pkg/cloudapi/compute/create_template.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create template +// CreateTemplateRequest struct to create template type CreateTemplateRequest struct { // ID of the compute to create template from // Required: true @@ -30,9 +30,7 @@ type wrapperCreateTemplateRequest struct { func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateTemplateRequest{ @@ -59,9 +57,7 @@ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateTemplateRequest{ diff --git a/pkg/cloudapi/compute/delete.go b/pkg/cloudapi/compute/delete.go index 2dff1c9..a087b3d 100644 --- a/pkg/cloudapi/compute/delete.go +++ b/pkg/cloudapi/compute/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete compute +// DeleteRequest struct to delete compute type DeleteRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type DeleteRequest struct { func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/delete" diff --git a/pkg/cloudapi/compute/delete_custom_fields.go b/pkg/cloudapi/compute/delete_custom_fields.go index 5e485ac..4becb16 100644 --- a/pkg/cloudapi/compute/delete_custom_fields.go +++ b/pkg/cloudapi/compute/delete_custom_fields.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for deleting compute's custome fields +// DeleteCustomFieldsRequest struct to delete compute's custom fields type DeleteCustomFieldsRequest struct { // ID of the compute // Required: true @@ -19,9 +19,7 @@ type DeleteCustomFieldsRequest struct { func (c Compute) DeleteCustomFields(ctx context.Context, req DeleteCustomFieldsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/deleteCustomFields" diff --git a/pkg/cloudapi/compute/detach_gpu.go b/pkg/cloudapi/compute/detach_gpu.go index e486d7b..82622c0 100644 --- a/pkg/cloudapi/compute/detach_gpu.go +++ b/pkg/cloudapi/compute/detach_gpu.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach vgpu for compute +// DetachGPURequest struct to detach vgpu for compute type DetachGPURequest struct { // Identifier compute // Required: true @@ -24,9 +24,7 @@ type DetachGPURequest struct { func (c Compute) DetachGPU(ctx context.Context, req DetachGPURequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/detachGpu" diff --git a/pkg/cloudapi/compute/detach_pci_device.go b/pkg/cloudapi/compute/detach_pci_device.go index 37c2be4..51a584c 100644 --- a/pkg/cloudapi/compute/detach_pci_device.go +++ b/pkg/cloudapi/compute/detach_pci_device.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach PCI device +// DetachPCIDeviceRequest struct to detach PCI device type DetachPCIDeviceRequest struct { // Identifier compute // Required: true @@ -23,9 +23,7 @@ type DetachPCIDeviceRequest struct { func (c Compute) DetachPCIDevice(ctx context.Context, req DetachPCIDeviceRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/detachPciDevice" diff --git a/pkg/cloudapi/compute/disable.go b/pkg/cloudapi/compute/disable.go index 815201f..9503563 100644 --- a/pkg/cloudapi/compute/disable.go +++ b/pkg/cloudapi/compute/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable compute +// DisableRequest struct to disable compute type DisableRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/disable" diff --git a/pkg/cloudapi/compute/disk_add.go b/pkg/cloudapi/compute/disk_add.go index 45895ec..3b958ce 100644 --- a/pkg/cloudapi/compute/disk_add.go +++ b/pkg/cloudapi/compute/disk_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create and attach disk to compute +// DiskAddRequest struct to create and attach disk to compute type DiskAddRequest struct { // ID of compute instance // Required: true @@ -52,9 +52,7 @@ type DiskAddRequest struct { func (c Compute) DiskAdd(ctx context.Context, req DiskAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskAdd" diff --git a/pkg/cloudapi/compute/disk_attach.go b/pkg/cloudapi/compute/disk_attach.go index 51355c4..47d0717 100644 --- a/pkg/cloudapi/compute/disk_attach.go +++ b/pkg/cloudapi/compute/disk_attach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for attach disk to compute +// DiskAttachRequest struct to attach disk to compute type DiskAttachRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type DiskAttachRequest struct { func (c Compute) DiskAttach(ctx context.Context, req DiskAttachRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskAttach" diff --git a/pkg/cloudapi/compute/disk_del.go b/pkg/cloudapi/compute/disk_del.go index 41c56c6..09cd88d 100644 --- a/pkg/cloudapi/compute/disk_del.go +++ b/pkg/cloudapi/compute/disk_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach and delete disk from compute +// DiskDelRequest struct to detach and delete disk from compute type DiskDelRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type DiskDelRequest struct { func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskDel" diff --git a/pkg/cloudapi/compute/disk_detach.go b/pkg/cloudapi/compute/disk_detach.go index 4274599..651047a 100644 --- a/pkg/cloudapi/compute/disk_detach.go +++ b/pkg/cloudapi/compute/disk_detach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach disk from compute +// DiskDetachRequest struct to detach disk from compute type DiskDetachRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type DiskDetachRequest struct { func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskDetach" diff --git a/pkg/cloudapi/compute/disk_qos.go b/pkg/cloudapi/compute/disk_qos.go index f6044f0..8583c7e 100644 --- a/pkg/cloudapi/compute/disk_qos.go +++ b/pkg/cloudapi/compute/disk_qos.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for change QoS of the disk +// DiskQOSRequest struct to change QoS of the disk type DiskQOSRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type DiskQOSRequest struct { func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskQos" diff --git a/pkg/cloudapi/compute/disk_resize.go b/pkg/cloudapi/compute/disk_resize.go index e04900a..f9d0fd0 100644 --- a/pkg/cloudapi/compute/disk_resize.go +++ b/pkg/cloudapi/compute/disk_resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for change disk size +// DiskResizeRequest struct to change disk size type DiskResizeRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type DiskResizeRequest struct { func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/diskResize" diff --git a/pkg/cloudapi/compute/enable.go b/pkg/cloudapi/compute/enable.go index 6d85bc8..54be5cc 100644 --- a/pkg/cloudapi/compute/enable.go +++ b/pkg/cloudapi/compute/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable compute +// EnableRequest struct to enable compute type EnableRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (c Compute) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/enable" diff --git a/pkg/cloudapi/compute/get.go b/pkg/cloudapi/compute/get.go index cf0777c..351b3c5 100644 --- a/pkg/cloudapi/compute/get.go +++ b/pkg/cloudapi/compute/get.go @@ -36,9 +36,7 @@ func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error func (c Compute) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/get" diff --git a/pkg/cloudapi/compute/get_audits.go b/pkg/cloudapi/compute/get_audits.go index 4fd96f4..fa47a4f 100644 --- a/pkg/cloudapi/compute/get_audits.go +++ b/pkg/cloudapi/compute/get_audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get compute audits +// GetAuditsRequest struct to get compute audits type GetAuditsRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type GetAuditsRequest struct { func (c Compute) GetAudits(ctx context.Context, req GetAuditsRequest) (ListShortAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/getAudits" diff --git a/pkg/cloudapi/compute/get_console_url.go b/pkg/cloudapi/compute/get_console_url.go index d813fd6..b228d1c 100644 --- a/pkg/cloudapi/compute/get_console_url.go +++ b/pkg/cloudapi/compute/get_console_url.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get console URL +// GetConsoleURLRequest struct to get console URL type GetConsoleURLRequest struct { // ID of compute instance to get console for // Required: true @@ -19,9 +19,7 @@ type GetConsoleURLRequest struct { func (c Compute) GetConsoleURL(ctx context.Context, req GetConsoleURLRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/getConsoleUrl" diff --git a/pkg/cloudapi/compute/get_custom_fields.go b/pkg/cloudapi/compute/get_custom_fields.go index 8aa39b6..0dfb981 100644 --- a/pkg/cloudapi/compute/get_custom_fields.go +++ b/pkg/cloudapi/compute/get_custom_fields.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting Compute's customFields +// GetCustomFieldsRequest struct to get Compute's customFields type GetCustomFieldsRequest struct { // Compute ID // Required: true @@ -19,9 +19,7 @@ type GetCustomFieldsRequest struct { func (c Compute) GetCustomFields(ctx context.Context, req GetCustomFieldsRequest) (interface{}, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/getCustomFields" diff --git a/pkg/cloudapi/compute/get_log.go b/pkg/cloudapi/compute/get_log.go index bdbe581..485d8f9 100644 --- a/pkg/cloudapi/compute/get_log.go +++ b/pkg/cloudapi/compute/get_log.go @@ -7,24 +7,22 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get compute logs +// GetLogRequest struct to get compute logs type GetLogRequest struct { // ID of compute instance to get log for // Required: true - ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` + ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` // Path to log file // Required: true - Path string `url:"path" json:"path" validate:"required"` + Path string `url:"path" json:"path" validate:"required"` } // GetLog gets compute's log file by path func (c Compute) GetLog(ctx context.Context, req GetLogRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/getLog" @@ -41,9 +39,7 @@ func (c Compute) GetLog(ctx context.Context, req GetLogRequest) (string, error) func (c Compute) GetLogGet(ctx context.Context, req GetLogRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi//compute/getLog" diff --git a/pkg/cloudapi/compute/list_deleted.go b/pkg/cloudapi/compute/list_deleted.go index 2f0e3c2..66a305d 100644 --- a/pkg/cloudapi/compute/list_deleted.go +++ b/pkg/cloudapi/compute/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get deleted computes list +// ListDeletedRequest struct to get deleted computes list type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudapi/compute/list_pci_device.go b/pkg/cloudapi/compute/list_pci_device.go index 74b4a29..b900b5f 100644 --- a/pkg/cloudapi/compute/list_pci_device.go +++ b/pkg/cloudapi/compute/list_pci_device.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list PCI devices +// ListPCIDeviceRequest struct to get list of PCI devices type ListPCIDeviceRequest struct { // Identifier compute // Required: true @@ -43,9 +43,7 @@ type ListPCIDeviceRequest struct { func (c Compute) ListPCIDevice(ctx context.Context, req ListPCIDeviceRequest) (*ListPCIDevices, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/listPciDevice" diff --git a/pkg/cloudapi/compute/list_vgpu.go b/pkg/cloudapi/compute/list_vgpu.go index 7459377..e84983c 100644 --- a/pkg/cloudapi/compute/list_vgpu.go +++ b/pkg/cloudapi/compute/list_vgpu.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list vGPU +// ListVGPURequest struct to get vGPU list type ListVGPURequest struct { // Identifier compute // Required: true @@ -43,9 +43,7 @@ type ListVGPURequest struct { func (c Compute) ListVGPU(ctx context.Context, req ListVGPURequest) (*ListVGPUs, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/listVGpu" diff --git a/pkg/cloudapi/compute/move_to_rg.go b/pkg/cloudapi/compute/move_to_rg.go index 60fabbf..592483a 100644 --- a/pkg/cloudapi/compute/move_to_rg.go +++ b/pkg/cloudapi/compute/move_to_rg.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for move compute new resource group +// MoveToRGRequest struct to move compute to new resource group type MoveToRGRequest struct { // ID of the compute instance to move // Required: true @@ -38,9 +38,7 @@ type MoveToRGRequest struct { func (c Compute) MoveToRG(ctx context.Context, req MoveToRGRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/moveToRg" diff --git a/pkg/cloudapi/compute/net_attach.go b/pkg/cloudapi/compute/net_attach.go index fe99583..46d3e44 100644 --- a/pkg/cloudapi/compute/net_attach.go +++ b/pkg/cloudapi/compute/net_attach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for attach network +// NetAttachRequest struct to attach network type NetAttachRequest struct { // ID of compute instance // Required: true @@ -31,13 +31,11 @@ type NetAttachRequest struct { IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` } -// NetAttach attach network to compute and gets info about network +// NetAttach attaches network to compute and gets info about network func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNetAttach, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/netAttach" diff --git a/pkg/cloudapi/compute/net_detach.go b/pkg/cloudapi/compute/net_detach.go index acfc96d..411debe 100644 --- a/pkg/cloudapi/compute/net_detach.go +++ b/pkg/cloudapi/compute/net_detach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach networ to compute +// NetDetachRequest struct to detach network from compute type NetDetachRequest struct { // ID of compute instance // Required: true @@ -23,13 +23,11 @@ type NetDetachRequest struct { MAC string `url:"mac,omitempty" json:"mac,omitempty"` } -// NetDetach detach network to compute +// NetDetach detaches network from compute func (c Compute) NetDetach(ctx context.Context, req NetDetachRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/netDetach" diff --git a/pkg/cloudapi/compute/pause.go b/pkg/cloudapi/compute/pause.go index 84ff546..c93adef 100644 --- a/pkg/cloudapi/compute/pause.go +++ b/pkg/cloudapi/compute/pause.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for pause compute +// PauseRequest struct to pause compute type PauseRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type PauseRequest struct { func (c Compute) Pause(ctx context.Context, req PauseRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/pause" diff --git a/pkg/cloudapi/compute/pfw_add.go b/pkg/cloudapi/compute/pfw_add.go index e6fa4a8..f896db1 100644 --- a/pkg/cloudapi/compute/pfw_add.go +++ b/pkg/cloudapi/compute/pfw_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add port forward rule +// PFWAddRequest struct to add port forward rule type PFWAddRequest struct { // ID of compute instance // Required: true @@ -37,9 +37,7 @@ type PFWAddRequest struct { func (c Compute) PFWAdd(ctx context.Context, req PFWAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/pfwAdd" diff --git a/pkg/cloudapi/compute/pfw_del.go b/pkg/cloudapi/compute/pfw_del.go index e899a6c..13ec81f 100644 --- a/pkg/cloudapi/compute/pfw_del.go +++ b/pkg/cloudapi/compute/pfw_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete port forward rule +// PFWDelRequest struct to delete port forward rule type PFWDelRequest struct { // ID of compute instance // Required: true @@ -36,13 +36,11 @@ type PFWDelRequest struct { Proto string `url:"proto,omitempty" json:"proto,omitempty"` } -// PFWDel delete port forward rule +// PFWDel deletes port forward rule func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/pfwDel" diff --git a/pkg/cloudapi/compute/pfw_list.go b/pkg/cloudapi/compute/pfw_list.go index 8aa8cf5..e4e3c0f 100644 --- a/pkg/cloudapi/compute/pfw_list.go +++ b/pkg/cloudapi/compute/pfw_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list port forwards +// PFWListRequest struct to get list of port forwards type PFWListRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type PFWListRequest struct { func (c Compute) PFWList(ctx context.Context, req PFWListRequest) (*ListPFWs, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/pfwList" diff --git a/pkg/cloudapi/compute/pin_to_stack.go b/pkg/cloudapi/compute/pin_to_stack.go index 3bbcfb6..176cc3c 100644 --- a/pkg/cloudapi/compute/pin_to_stack.go +++ b/pkg/cloudapi/compute/pin_to_stack.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for pin comptute to stack +// PinToStackRequest struct to pin compute to stack type PinToStackRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type PinToStackRequest struct { func (c Compute) PinToStack(ctx context.Context, req PinToStackRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/pinToStack" diff --git a/pkg/cloudapi/compute/power_cycle.go b/pkg/cloudapi/compute/power_cycle.go index ced6485..b457138 100644 --- a/pkg/cloudapi/compute/power_cycle.go +++ b/pkg/cloudapi/compute/power_cycle.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for force stop and start compute +// PowerCycleRequest struct to force stop and start compute type PowerCycleRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type PowerCycleRequest struct { func (c Compute) PowerCycle(ctx context.Context, req PowerCycleRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/powerCycle" diff --git a/pkg/cloudapi/compute/reboot.go b/pkg/cloudapi/compute/reboot.go index 223dcbe..a2e86e2 100644 --- a/pkg/cloudapi/compute/reboot.go +++ b/pkg/cloudapi/compute/reboot.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reboot compute +// RebootRequest struct to reboot compute type RebootRequest struct { // ID of compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// Reboot reboot compute +// Reboot reboots compute func (c Compute) Reboot(ctx context.Context, req RebootRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/reboot" diff --git a/pkg/cloudapi/compute/redeploy.go b/pkg/cloudapi/compute/redeploy.go index b993f1c..22ee5fa 100644 --- a/pkg/cloudapi/compute/redeploy.go +++ b/pkg/cloudapi/compute/redeploy.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for redeploy +// RedeployRequest struct to redeploy type RedeployRequest struct { // ID of compute instance // Required: true @@ -27,7 +27,7 @@ type RedeployRequest struct { // Required: false DataDisks string `url:"dataDisks,omitempty" json:"dataDisks,omitempty"` - // Should the compute be restarted upon successful redeploy + // Should compute be restarted upon successful redeploy // Required: false AutoStart bool `url:"autoStart,omitempty" json:"autoStart,omitempty"` @@ -36,13 +36,11 @@ type RedeployRequest struct { ForceStop bool `url:"forceStop,omitempty" json:"forceStop,omitempty"` } -// Redeploy redeploy compute +// Redeploy redeploys compute func (c Compute) Redeploy(ctx context.Context, req RedeployRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/redeploy" diff --git a/pkg/cloudapi/compute/reset.go b/pkg/cloudapi/compute/reset.go index 4a00dca..3297e59 100644 --- a/pkg/cloudapi/compute/reset.go +++ b/pkg/cloudapi/compute/reset.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reset compute +// ResetRequest struct to reset compute type ResetRequest struct { // ID of compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// Reset reset compute +// Reset resets compute func (c Compute) Reset(ctx context.Context, req ResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/reset" diff --git a/pkg/cloudapi/compute/resize.go b/pkg/cloudapi/compute/resize.go index 302ecc2..f2c3b1e 100644 --- a/pkg/cloudapi/compute/resize.go +++ b/pkg/cloudapi/compute/resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resize compute +// ResizeRequest struct to resize compute type ResizeRequest struct { // ID of compute instance // Required: true @@ -29,13 +29,11 @@ type ResizeRequest struct { Force bool `url:"force,omitempty" json:"force,omitempty"` } -// Resize resize compute instance +// Resize resizes compute instance func (c Compute) Resize(ctx context.Context, req ResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/resize" diff --git a/pkg/cloudapi/compute/restore.go b/pkg/cloudapi/compute/restore.go index f5bdfab..04bc504 100644 --- a/pkg/cloudapi/compute/restore.go +++ b/pkg/cloudapi/compute/restore.go @@ -7,20 +7,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore compute +// RestoreRequest struct to restore compute type RestoreRequest struct { // ID of compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// Restore restore compute from recycle bin +// Restore restores compute from recycle bin func (c Compute) Restore(ctx context.Context, req RestoreRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/restore" diff --git a/pkg/cloudapi/compute/resume.go b/pkg/cloudapi/compute/resume.go index 123e245..f8754db 100644 --- a/pkg/cloudapi/compute/resume.go +++ b/pkg/cloudapi/compute/resume.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resume compute +// ResumeRequest struct to resume compute type ResumeRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type ResumeRequest struct { func (c Compute) Resume(ctx context.Context, req ResumeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/resume" diff --git a/pkg/cloudapi/compute/set_custom_fields.go b/pkg/cloudapi/compute/set_custom_fields.go index f0ac2c5..2e9f3ee 100644 --- a/pkg/cloudapi/compute/set_custom_fields.go +++ b/pkg/cloudapi/compute/set_custom_fields.go @@ -7,7 +7,8 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for setting customFields values for the Compute + +// SetCustomFieldsRequest struct to set customFields values for the Compute type SetCustomFieldsRequest struct { // ID of the compute // Required: true @@ -22,9 +23,7 @@ type SetCustomFieldsRequest struct { func (c Compute) SetCustomFields(ctx context.Context, req SetCustomFieldsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/setCustomFields" diff --git a/pkg/cloudapi/compute/snapshot_create.go b/pkg/cloudapi/compute/snapshot_create.go index 06a4118..4f8213e 100644 --- a/pkg/cloudapi/compute/snapshot_create.go +++ b/pkg/cloudapi/compute/snapshot_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create snapshot +// SnapshotCreateRequest struct to create snapshot type SnapshotCreateRequest struct { // ID of the compute instance to create snapshot for // Required: true @@ -24,9 +24,7 @@ type SnapshotCreateRequest struct { func (c Compute) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/snapshotCreate" diff --git a/pkg/cloudapi/compute/snapshot_delete.go b/pkg/cloudapi/compute/snapshot_delete.go index 7124235..48b7eb7 100644 --- a/pkg/cloudapi/compute/snapshot_delete.go +++ b/pkg/cloudapi/compute/snapshot_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete snapshot +// SnapshotDeleteRequest struct to delete snapshot type SnapshotDeleteRequest struct { // ID of the compute instance // Required: true @@ -19,13 +19,11 @@ type SnapshotDeleteRequest struct { Label string `url:"label" json:"label" validate:"required"` } -// SnapshotDelete delete specified compute snapshot +// SnapshotDelete deletes specified compute snapshot func (c Compute) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/snapshotDelete" diff --git a/pkg/cloudapi/compute/snapshot_list.go b/pkg/cloudapi/compute/snapshot_list.go index 5ecaaf0..37df275 100644 --- a/pkg/cloudapi/compute/snapshot_list.go +++ b/pkg/cloudapi/compute/snapshot_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list snapshots +// SnapshotListRequest struct to get list snapshots type SnapshotListRequest struct { // ID of the compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// SnapshotList gets list compute snapshots +// SnapshotList gets list of compute snapshots func (c Compute) SnapshotList(ctx context.Context, req SnapshotListRequest) (*ListSnapShots, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/snapshotList" diff --git a/pkg/cloudapi/compute/snapshot_rollback.go b/pkg/cloudapi/compute/snapshot_rollback.go index 047e91f..0c74591 100644 --- a/pkg/cloudapi/compute/snapshot_rollback.go +++ b/pkg/cloudapi/compute/snapshot_rollback.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rollback +// SnapshotRollbackRequest struct for rollback type SnapshotRollbackRequest struct { // ID of the compute instance // Required: true @@ -19,13 +19,11 @@ type SnapshotRollbackRequest struct { Label string `url:"label" json:"label" validate:"required"` } -// SnapshotRollback rollback specified compute snapshot +// SnapshotRollback rollbacks specified compute snapshot func (c Compute) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/snapshotRollback" diff --git a/pkg/cloudapi/compute/snapshot_usage.go b/pkg/cloudapi/compute/snapshot_usage.go index 8761b62..f16e3fa 100644 --- a/pkg/cloudapi/compute/snapshot_usage.go +++ b/pkg/cloudapi/compute/snapshot_usage.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get compute snapshot real size on storage +// SnapshotUsageRequest struct to get compute snapshot real size on storage type SnapshotUsageRequest struct { // ID of the compute instance // Required: true @@ -20,15 +20,13 @@ type SnapshotUsageRequest struct { Label string `url:"label,omitempty" json:"label,omitempty"` } -// SnapshotUsage Get compute snapshot real size on storage. +// SnapshotUsage gets compute snapshot real size on storage. // Always returns list of json objects, and first json object contains summary about all related // snapshots. func (c Compute) SnapshotUsage(ctx context.Context, req SnapshotUsageRequest) (ListUsageSnapshots, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/snapshotUsage" diff --git a/pkg/cloudapi/compute/start.go b/pkg/cloudapi/compute/start.go index aba5ff7..511836b 100644 --- a/pkg/cloudapi/compute/start.go +++ b/pkg/cloudapi/compute/start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start compute +// StartRequest struct to start compute type StartRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type StartRequest struct { func (c Compute) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/start" diff --git a/pkg/cloudapi/compute/stop.go b/pkg/cloudapi/compute/stop.go index e973890..0205ba1 100644 --- a/pkg/cloudapi/compute/stop.go +++ b/pkg/cloudapi/compute/stop.go @@ -8,11 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop compute +// StopRequest struct to stop compute type StopRequest struct { // ID of compute instance // Required: true - ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` + ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` // Force stop compute // Required: false @@ -23,9 +23,7 @@ type StopRequest struct { func (c Compute) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/stop" diff --git a/pkg/cloudapi/compute/tag_add.go b/pkg/cloudapi/compute/tag_add.go index cc6d786..dcf72f6 100644 --- a/pkg/cloudapi/compute/tag_add.go +++ b/pkg/cloudapi/compute/tag_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add tag to compute +// TagAddRequest struct to add tag to compute type TagAddRequest struct { // ID of the compute instance // Required: true @@ -27,9 +27,7 @@ type TagAddRequest struct { func (c Compute) TagAdd(ctx context.Context, req TagAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/tagAdd" diff --git a/pkg/cloudapi/compute/tag_remove.go b/pkg/cloudapi/compute/tag_remove.go index e12496e..f79c867 100644 --- a/pkg/cloudapi/compute/tag_remove.go +++ b/pkg/cloudapi/compute/tag_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove tag from compute +// TagRemoveRequest struct to remove tag from compute type TagRemoveRequest struct { // ID of the compute instance // Required: true @@ -23,9 +23,7 @@ type TagRemoveRequest struct { func (c Compute) TagRemove(ctx context.Context, req TagRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/tagRemove" diff --git a/pkg/cloudapi/compute/unpin_from_stack.go b/pkg/cloudapi/compute/unpin_from_stack.go index 9907666..0bc3453 100644 --- a/pkg/cloudapi/compute/unpin_from_stack.go +++ b/pkg/cloudapi/compute/unpin_from_stack.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for unpin from stack +// UnpinFromStackRequest struct for unpin from stack type UnpinFromStackRequest struct { // ID of the compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// UnpinFromStack unpin compute from current stack +// UnpinFromStack unpins compute from current stack func (c Compute) UnpinFromStack(ctx context.Context, req UnpinFromStackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/unpinFromStack" diff --git a/pkg/cloudapi/compute/update.go b/pkg/cloudapi/compute/update.go index 67fd8dc..add4cdb 100644 --- a/pkg/cloudapi/compute/update.go +++ b/pkg/cloudapi/compute/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update compute +// UpdateRequest struct to update compute type UpdateRequest struct { // ID of the compute // Required: true @@ -27,9 +27,7 @@ type UpdateRequest struct { func (c Compute) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/update" diff --git a/pkg/cloudapi/compute/user_grant.go b/pkg/cloudapi/compute/user_grant.go index c6894c7..9420ab8 100644 --- a/pkg/cloudapi/compute/user_grant.go +++ b/pkg/cloudapi/compute/user_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to compute +// UserGrantRequest struct to grant access to compute type UserGrantRequest struct { // ID of the compute instance // Required: true @@ -27,13 +27,11 @@ type UserGrantRequest struct { AccessType string `url:"accesstype" json:"accesstype" validate:"accessType"` } -// UserGrant grant user access to the compute +// UserGrant grants user access to the compute func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/userGrant" diff --git a/pkg/cloudapi/compute/user_list.go b/pkg/cloudapi/compute/user_list.go index 5acb135..0938d8c 100644 --- a/pkg/cloudapi/compute/user_list.go +++ b/pkg/cloudapi/compute/user_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list users for compute +// UserListRequest struct to get list of users for compute type UserListRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type UserListRequest struct { func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/userList" diff --git a/pkg/cloudapi/compute/user_revoke.go b/pkg/cloudapi/compute/user_revoke.go index 3cd1076..9897959 100644 --- a/pkg/cloudapi/compute/user_revoke.go +++ b/pkg/cloudapi/compute/user_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke user access +// UserRevokeRequest struct to revoke user access type UserRevokeRequest struct { // ID of the compute instance // Required: true @@ -23,9 +23,7 @@ type UserRevokeRequest struct { func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/userRevoke" diff --git a/pkg/cloudapi/compute/user_update.go b/pkg/cloudapi/compute/user_update.go index fee2917..623bc01 100644 --- a/pkg/cloudapi/compute/user_update.go +++ b/pkg/cloudapi/compute/user_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update user access +// UserUpdateRequest struct to update user access type UserUpdateRequest struct { // ID of the compute instance // Required: true @@ -31,9 +31,7 @@ type UserUpdateRequest struct { func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/compute/userUpdate" diff --git a/pkg/cloudapi/disks/create.go b/pkg/cloudapi/disks/create.go index 28e1d40..7568e29 100644 --- a/pkg/cloudapi/disks/create.go +++ b/pkg/cloudapi/disks/create.go @@ -3,12 +3,11 @@ package disks import ( "context" "net/http" - "strconv" - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" + "strconv" ) -// Request struct for create disk +// CreateRequest struct to create disk type CreateRequest struct { // ID of the account // Required: true @@ -58,9 +57,7 @@ type CreateRequest struct { func (d Disks) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/create" diff --git a/pkg/cloudapi/disks/delete.go b/pkg/cloudapi/disks/delete.go index ae2fbbd..030de9e 100644 --- a/pkg/cloudapi/disks/delete.go +++ b/pkg/cloudapi/disks/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request for delete disk +// DeleteRequest to delete disk type DeleteRequest struct { // ID of disk to delete // Required: true @@ -31,9 +31,7 @@ type DeleteRequest struct { func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/delete" diff --git a/pkg/cloudapi/disks/delete_disks.go b/pkg/cloudapi/disks/delete_disks.go index cca44b7..ebbe743 100644 --- a/pkg/cloudapi/disks/delete_disks.go +++ b/pkg/cloudapi/disks/delete_disks.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for multiple disks +// DisksDeleteRequest struct for multiple disks type DisksDeleteRequest struct { // List of disk ids to delete // Required: true @@ -27,9 +27,7 @@ type DisksDeleteRequest struct { func (d Disks) DeleteDisks(ctx context.Context, req DisksDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/deleteDisks" diff --git a/pkg/cloudapi/disks/get.go b/pkg/cloudapi/disks/get.go index 94706c2..5f1aad9 100644 --- a/pkg/cloudapi/disks/get.go +++ b/pkg/cloudapi/disks/get.go @@ -38,9 +38,7 @@ func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) { func (d Disks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/get" diff --git a/pkg/cloudapi/disks/limitio.go b/pkg/cloudapi/disks/limitio.go index 1130032..0550dcc 100644 --- a/pkg/cloudapi/disks/limitio.go +++ b/pkg/cloudapi/disks/limitio.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for limit IO +// LimitIORequest struct for limit IO type LimitIORequest struct { // ID of the disk to limit // Required: true @@ -77,9 +77,7 @@ type LimitIORequest struct { func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/limitIO" diff --git a/pkg/cloudapi/disks/list_deleted.go b/pkg/cloudapi/disks/list_deleted.go index b3a5f29..bef9ff8 100644 --- a/pkg/cloudapi/disks/list_deleted.go +++ b/pkg/cloudapi/disks/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list of deleted disks +// ListDeletedRequest struct to get list of deleted disks type ListDeletedRequest struct { // Find by id // Required: false diff --git a/pkg/cloudapi/disks/list_types.go b/pkg/cloudapi/disks/list_types.go index 5c37b19..132c555 100644 --- a/pkg/cloudapi/disks/list_types.go +++ b/pkg/cloudapi/disks/list_types.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list types of disks +// ListTypesRequest struct to get list types of disks type ListTypesRequest struct { // Show detailed disk types by seps // Required: true diff --git a/pkg/cloudapi/disks/list_unattached.go b/pkg/cloudapi/disks/list_unattached.go index 2c823d7..3c05a0f 100644 --- a/pkg/cloudapi/disks/list_unattached.go +++ b/pkg/cloudapi/disks/list_unattached.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list unattached disk +// ListUnattachedRequest struct to get list of unattached disk type ListUnattachedRequest struct { // Find by id // Required: false diff --git a/pkg/cloudapi/disks/rename.go b/pkg/cloudapi/disks/rename.go index 45c309c..cf9eda0 100644 --- a/pkg/cloudapi/disks/rename.go +++ b/pkg/cloudapi/disks/rename.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rename disk +// RenameRequest struct to rename disk type RenameRequest struct { // ID of the disk to rename // Required: true @@ -19,13 +19,11 @@ type RenameRequest struct { Name string `url:"name" json:"name" validate:"required"` } -// Rename rename disk +// Rename renames disk func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/rename" diff --git a/pkg/cloudapi/disks/resize.go b/pkg/cloudapi/disks/resize.go index 34a9fbe..b317c4c 100644 --- a/pkg/cloudapi/disks/resize.go +++ b/pkg/cloudapi/disks/resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resize disk +// ResizeRequest struct to resize disk type ResizeRequest struct { // ID of the disk to resize // Required: true @@ -19,16 +19,14 @@ type ResizeRequest struct { Size uint64 `url:"size" json:"size" validate:"required"` } -// Resize resize disk +// Resize resizes disk // Returns 200 if disk is resized online, else will return 202, // in that case please stop and start your machine after changing the disk size, for your changes to be reflected. // This method will not be used for disks, assigned to computes. Only unassigned disks and disks, assigned with "old" virtual machines. func (d Disks) Resize(ctx context.Context, req ResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/resize" @@ -53,9 +51,7 @@ func (d Disks) Resize(ctx context.Context, req ResizeRequest) (bool, error) { func (d Disks) Resize2(ctx context.Context, req ResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/resize2" diff --git a/pkg/cloudapi/disks/restore.go b/pkg/cloudapi/disks/restore.go index d96abb9..60fd49d 100644 --- a/pkg/cloudapi/disks/restore.go +++ b/pkg/cloudapi/disks/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore a deleted unattached disk +// RestoreRequest struct to restore a deleted unattached disk type RestoreRequest struct { // ID of the disk to restore // Required: true @@ -19,13 +19,11 @@ type RestoreRequest struct { Reason string `url:"reason" json:"reason" validate:"required"` } -// Restore restore a deleted unattached disk from recycle bin +// Restore restores a deleted unattached disk from recycle bin func (d Disks) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/restore" diff --git a/pkg/cloudapi/disks/search.go b/pkg/cloudapi/disks/search.go index 72ef725..b6ca831 100644 --- a/pkg/cloudapi/disks/search.go +++ b/pkg/cloudapi/disks/search.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for search +// SearchRequest struct for search type SearchRequest struct { // ID of the account to search for the Disk // Required: false @@ -20,7 +20,7 @@ type SearchRequest struct { ShowAll bool `url:"show_all,omitempty" json:"show_all,omitempty"` } -// Search search disks +// Search searches disks func (d Disks) Search(ctx context.Context, req SearchRequest) (ListSearchDisks, error) { url := "/cloudapi/disks/search" diff --git a/pkg/cloudapi/disks/share.go b/pkg/cloudapi/disks/share.go index ab74db7..46ef253 100644 --- a/pkg/cloudapi/disks/share.go +++ b/pkg/cloudapi/disks/share.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for share data disk +// ShareRequest struct to share disk data type ShareRequest struct { // ID of the disk to share // Required: true @@ -19,9 +19,7 @@ type ShareRequest struct { func (d Disks) Share(ctx context.Context, req ShareRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/share" diff --git a/pkg/cloudapi/disks/snapshot_delete.go b/pkg/cloudapi/disks/snapshot_delete.go index b6d867d..406904c 100644 --- a/pkg/cloudapi/disks/snapshot_delete.go +++ b/pkg/cloudapi/disks/snapshot_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete snapshot +// SnapshotDeleteRequest struct to delete snapshot type SnapshotDeleteRequest struct { // ID of disk to delete // Required: true @@ -23,9 +23,7 @@ type SnapshotDeleteRequest struct { func (d Disks) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/snapshotDelete" diff --git a/pkg/cloudapi/disks/snapshot_rollback.go b/pkg/cloudapi/disks/snapshot_rollback.go index 8838bd8..44bf578 100644 --- a/pkg/cloudapi/disks/snapshot_rollback.go +++ b/pkg/cloudapi/disks/snapshot_rollback.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rollback snapshot +// SnapshotRollbackRequest struct to rollback snapshot type SnapshotRollbackRequest struct { // ID of the disk // Required: true @@ -23,13 +23,11 @@ type SnapshotRollbackRequest struct { TimeStamp uint64 `url:"timestamp,omitempty" json:"timestamp,omitempty"` } -// SnapshotRollback rollback an individual disk snapshot +// SnapshotRollback rollbacks an individual disk snapshot func (d Disks) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/snapshotRollback" diff --git a/pkg/cloudapi/disks/unshare.go b/pkg/cloudapi/disks/unshare.go index 18f48d6..94c5893 100644 --- a/pkg/cloudapi/disks/unshare.go +++ b/pkg/cloudapi/disks/unshare.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for unshare data disk +// UnshareRequest struct to unshare data disk type UnshareRequest struct { // ID of the disk to unshare // Required: true @@ -19,9 +19,7 @@ type UnshareRequest struct { func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/disks/unshare" diff --git a/pkg/cloudapi/extnet/get.go b/pkg/cloudapi/extnet/get.go index a9bc232..4d4fc4c 100644 --- a/pkg/cloudapi/extnet/get.go +++ b/pkg/cloudapi/extnet/get.go @@ -36,9 +36,7 @@ func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error) func (e ExtNet) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/extnet/get" diff --git a/pkg/cloudapi/extnet/list_computes.go b/pkg/cloudapi/extnet/list_computes.go index dc1a748..627b730 100644 --- a/pkg/cloudapi/extnet/list_computes.go +++ b/pkg/cloudapi/extnet/list_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list computes +// ListComputesRequest struct to get list computes type ListComputesRequest struct { // Filter by account ID // Required: true @@ -35,9 +35,7 @@ type ListComputesRequest struct { func (e ExtNet) ListComputes(ctx context.Context, req ListComputesRequest) (*ListExtNetComputes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/extnet/listComputes" diff --git a/pkg/cloudapi/flipgroup/compute_add.go b/pkg/cloudapi/flipgroup/compute_add.go index 59cdf64..39027c1 100644 --- a/pkg/cloudapi/flipgroup/compute_add.go +++ b/pkg/cloudapi/flipgroup/compute_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add compute instance +// ComputeAddRequest struct to add compute instance type ComputeAddRequest struct { // ID of the Floating IP group to add compute instance to // Required: true @@ -23,9 +23,7 @@ type ComputeAddRequest struct { func (f FLIPGroup) ComputeAdd(ctx context.Context, req ComputeAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/flipgroup/computeAdd" diff --git a/pkg/cloudapi/flipgroup/compute_remove.go b/pkg/cloudapi/flipgroup/compute_remove.go index 94c8b79..c139d2b 100644 --- a/pkg/cloudapi/flipgroup/compute_remove.go +++ b/pkg/cloudapi/flipgroup/compute_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove compute instance +// ComputeRemoveRequest struct to remove compute instance type ComputeRemoveRequest struct { // ID of the Floating IP group to remove compute instance from // Required: true @@ -23,9 +23,7 @@ type ComputeRemoveRequest struct { func (f FLIPGroup) ComputeRemove(ctx context.Context, req ComputeRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/flipgroup/computeRemove" diff --git a/pkg/cloudapi/flipgroup/create.go b/pkg/cloudapi/flipgroup/create.go index 2c292c7..97d0ce0 100644 --- a/pkg/cloudapi/flipgroup/create.go +++ b/pkg/cloudapi/flipgroup/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create FLIPGroup +// CreateRequest struct to create FLIPGroup type CreateRequest struct { // Account ID // Required: true @@ -48,9 +48,7 @@ type CreateRequest struct { func (f FLIPGroup) Create(ctx context.Context, req CreateRequest) (*RecordFLIPGroupCreated, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/flipgroup/create" diff --git a/pkg/cloudapi/flipgroup/delete.go b/pkg/cloudapi/flipgroup/delete.go index a1e2cc0..90e9b3b 100644 --- a/pkg/cloudapi/flipgroup/delete.go +++ b/pkg/cloudapi/flipgroup/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete FLIPGroup +// DeleteRequest struct to delete FLIPGroup type DeleteRequest struct { // FLIPGroup ID // Required: true @@ -19,9 +19,7 @@ type DeleteRequest struct { func (f FLIPGroup) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/flipgroup/delete" diff --git a/pkg/cloudapi/flipgroup/edit.go b/pkg/cloudapi/flipgroup/edit.go index f24c91a..0e05287 100644 --- a/pkg/cloudapi/flipgroup/edit.go +++ b/pkg/cloudapi/flipgroup/edit.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for edit FLIPGroup +// EditRequest struct to edit FLIPGroup type EditRequest struct { // FLIPGroup ID // Required: true @@ -27,9 +27,7 @@ type EditRequest struct { func (f FLIPGroup) Edit(ctx context.Context, req EditRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/flipgroup/edit" diff --git a/pkg/cloudapi/flipgroup/get.go b/pkg/cloudapi/flipgroup/get.go index d259962..a91c5d1 100644 --- a/pkg/cloudapi/flipgroup/get.go +++ b/pkg/cloudapi/flipgroup/get.go @@ -36,9 +36,7 @@ func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, e func (f FLIPGroup) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/flipgroup/get" diff --git a/pkg/cloudapi/image/create.go b/pkg/cloudapi/image/create.go index 1ebe8bc..a0253c1 100644 --- a/pkg/cloudapi/image/create.go +++ b/pkg/cloudapi/image/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create image +// CreateRequest struct to create image type CreateRequest struct { // Name of the rescue disk // Required: true @@ -83,9 +83,7 @@ type CreateRequest struct { func (i Image) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/image/create" diff --git a/pkg/cloudapi/image/create_virtual.go b/pkg/cloudapi/image/create_virtual.go index 7141f70..1f56441 100644 --- a/pkg/cloudapi/image/create_virtual.go +++ b/pkg/cloudapi/image/create_virtual.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create virtual image +// CreateVirtualRequest struct to create virtual image type CreateVirtualRequest struct { // Name of the virtual image to create // Required: true @@ -23,9 +23,7 @@ type CreateVirtualRequest struct { func (i Image) CreateVirtual(ctx context.Context, req CreateVirtualRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/image/createVirtual" diff --git a/pkg/cloudapi/image/delete.go b/pkg/cloudapi/image/delete.go index 1ce5104..7066ab5 100644 --- a/pkg/cloudapi/image/delete.go +++ b/pkg/cloudapi/image/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete image +// DeleteRequest struct to delete image type DeleteRequest struct { // ID of the image to delete // Required: true @@ -23,9 +23,7 @@ type DeleteRequest struct { func (i Image) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/image/delete" diff --git a/pkg/cloudapi/image/get.go b/pkg/cloudapi/image/get.go index 263129b..c530ee4 100644 --- a/pkg/cloudapi/image/get.go +++ b/pkg/cloudapi/image/get.go @@ -42,9 +42,7 @@ func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) { func (i Image) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/image/get" diff --git a/pkg/cloudapi/image/link.go b/pkg/cloudapi/image/link.go index c260dc7..4ad8824 100644 --- a/pkg/cloudapi/image/link.go +++ b/pkg/cloudapi/image/link.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for link virtual image to another image +// LinkRequest struct to link virtual image to another image type LinkRequest struct { // ID of the virtual image // Required: true @@ -23,9 +23,7 @@ type LinkRequest struct { func (i Image) Link(ctx context.Context, req LinkRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/image/link" diff --git a/pkg/cloudapi/image/rename.go b/pkg/cloudapi/image/rename.go index a6f4b10..bb3aa4a 100644 --- a/pkg/cloudapi/image/rename.go +++ b/pkg/cloudapi/image/rename.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rename image +// RenameRequest struct to rename image type RenameRequest struct { // ID of the virtual image to rename // Required: true @@ -23,9 +23,7 @@ type RenameRequest struct { func (i Image) Rename(ctx context.Context, req RenameRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/image/rename" diff --git a/pkg/cloudapi/k8ci/get.go b/pkg/cloudapi/k8ci/get.go index 1e1bcf1..91b6e19 100644 --- a/pkg/cloudapi/k8ci/get.go +++ b/pkg/cloudapi/k8ci/get.go @@ -35,9 +35,7 @@ func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) { func (k K8CI) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8ci/get" diff --git a/pkg/cloudapi/k8ci/list_deleted.go b/pkg/cloudapi/k8ci/list_deleted.go index 8f49388..9e0142f 100644 --- a/pkg/cloudapi/k8ci/list_deleted.go +++ b/pkg/cloudapi/k8ci/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list information about deleted images +// ListDeletedRequest struct to get list information about deleted images type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudapi/k8s/create.go b/pkg/cloudapi/k8s/create.go index 8432557..8f42d25 100644 --- a/pkg/cloudapi/k8s/create.go +++ b/pkg/cloudapi/k8s/create.go @@ -10,7 +10,7 @@ import ( // type Params []string -// Request struct for create kubernetes cluster +// CreateRequest struct to create kubernetes cluster type CreateRequest struct { // Name of Kubernetes cluster // Required: true @@ -173,12 +173,9 @@ type CreateRequest struct { // Create creates a new Kubernetes cluster in the specified Resource Group func (k8s K8S) Create(ctx context.Context, req CreateRequest) (string, error) { - err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } // var params []string diff --git a/pkg/cloudapi/k8s/delete.go b/pkg/cloudapi/k8s/delete.go index 5a5a71c..7f9fdfe 100644 --- a/pkg/cloudapi/k8s/delete.go +++ b/pkg/cloudapi/k8s/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete kubernetes cluster +// DeleteRequest struct to delete kubernetes cluster type DeleteRequest struct { // Kubernetes cluster ID // Required: true @@ -24,9 +24,7 @@ type DeleteRequest struct { func (k8s K8S) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/delete" diff --git a/pkg/cloudapi/k8s/delete_master_from_group.go b/pkg/cloudapi/k8s/delete_master_from_group.go index b23b231..796a51e 100644 --- a/pkg/cloudapi/k8s/delete_master_from_group.go +++ b/pkg/cloudapi/k8s/delete_master_from_group.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete master from group +// DeleteMasterFromGroupRequest struct to delete master from group type DeleteMasterFromGroupRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type DeleteMasterFromGroupRequest struct { func (k8s K8S) DeleteMasterFromGroup(ctx context.Context, req DeleteMasterFromGroupRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/deleteMasterFromGroup" diff --git a/pkg/cloudapi/k8s/delete_worker_from_group.go b/pkg/cloudapi/k8s/delete_worker_from_group.go index 748d26a..b08911f 100644 --- a/pkg/cloudapi/k8s/delete_worker_from_group.go +++ b/pkg/cloudapi/k8s/delete_worker_from_group.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete worker from group +// DeleteWorkerFromGroupRequest struct to delete worker from group type DeleteWorkerFromGroupRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type DeleteWorkerFromGroupRequest struct { func (k8s K8S) DeleteWorkerFromGroup(ctx context.Context, req DeleteWorkerFromGroupRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/deleteWorkerFromGroup" diff --git a/pkg/cloudapi/k8s/disable_enable.go b/pkg/cloudapi/k8s/disable_enable.go index 76158a7..8c23bf3 100644 --- a/pkg/cloudapi/k8s/disable_enable.go +++ b/pkg/cloudapi/k8s/disable_enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable/enable kubernetes cluster +// DisableEnableRequest struct to disable/enable kubernetes cluster type DisableEnableRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type DisableEnableRequest struct { func (k8s K8S) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/disable" @@ -43,9 +41,7 @@ func (k8s K8S) Disable(ctx context.Context, req DisableEnableRequest) (bool, err func (k8s K8S) Enable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/enable" diff --git a/pkg/cloudapi/k8s/find_group_by_label.go b/pkg/cloudapi/k8s/find_group_by_label.go index 2eaa838..c49ebbd 100644 --- a/pkg/cloudapi/k8s/find_group_by_label.go +++ b/pkg/cloudapi/k8s/find_group_by_label.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get information about group of kubernetes cluster +// FindGroupByLabelRequest struct to get information about group of kubernetes cluster type FindGroupByLabelRequest struct { // Kubernetes cluster ID // Required: true @@ -28,9 +28,7 @@ type FindGroupByLabelRequest struct { func (k8s K8S) FindGroupByLabel(ctx context.Context, req FindGroupByLabelRequest) (ListK8SGroups, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/findGroupByLabel" diff --git a/pkg/cloudapi/k8s/get.go b/pkg/cloudapi/k8s/get.go index 01e6e1a..26f3aff 100644 --- a/pkg/cloudapi/k8s/get.go +++ b/pkg/cloudapi/k8s/get.go @@ -36,9 +36,7 @@ func (k8s K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) { func (k8s K8S) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/get" diff --git a/pkg/cloudapi/k8s/get_config.go b/pkg/cloudapi/k8s/get_config.go index 79a7c56..3e69caf 100644 --- a/pkg/cloudapi/k8s/get_config.go +++ b/pkg/cloudapi/k8s/get_config.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get configuration of kubernetes cluster +// GetConfigRequest struct to get configuration of kubernetes cluster type GetConfigRequest struct { // Kubernetes cluster ID // Required: true @@ -18,9 +18,7 @@ type GetConfigRequest struct { func (k8s K8S) GetConfig(ctx context.Context, req GetConfigRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/getConfig" diff --git a/pkg/cloudapi/k8s/get_node_annotations.go b/pkg/cloudapi/k8s/get_node_annotations.go index be1eb49..8950868 100644 --- a/pkg/cloudapi/k8s/get_node_annotations.go +++ b/pkg/cloudapi/k8s/get_node_annotations.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get node annotations +// GetNodeAnnotationsRequest struct to get node annotations type GetNodeAnnotationsRequest struct { // Kubernetes cluster ID // Required: true @@ -22,9 +22,7 @@ type GetNodeAnnotationsRequest struct { func (k8s K8S) GetNodeAnnotations(ctx context.Context, req GetNodeAnnotationsRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/getNodeAnnotations" diff --git a/pkg/cloudapi/k8s/get_node_labels.go b/pkg/cloudapi/k8s/get_node_labels.go index 3d5773a..2db39d5 100644 --- a/pkg/cloudapi/k8s/get_node_labels.go +++ b/pkg/cloudapi/k8s/get_node_labels.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get node labels +// GetNodeLabelsRequest struct to get node labels type GetNodeLabelsRequest struct { // Kubernetes cluster ID // Required: true @@ -22,9 +22,7 @@ type GetNodeLabelsRequest struct { func (k8s K8S) GetNodeLabels(ctx context.Context, req GetNodeLabelsRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/getNodeLabels" diff --git a/pkg/cloudapi/k8s/get_node_taints.go b/pkg/cloudapi/k8s/get_node_taints.go index 34dfdc2..cf83e31 100644 --- a/pkg/cloudapi/k8s/get_node_taints.go +++ b/pkg/cloudapi/k8s/get_node_taints.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get node taints +// GetNodeTaintsRequest struct to get node taints type GetNodeTaintsRequest struct { // Kubernetes cluster ID // Required: true @@ -22,9 +22,7 @@ type GetNodeTaintsRequest struct { func (k8s K8S) GetNodeTaints(ctx context.Context, req GetNodeTaintsRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/getNodeTaints" diff --git a/pkg/cloudapi/k8s/get_worker_nodes_meta_data.go b/pkg/cloudapi/k8s/get_worker_nodes_meta_data.go index 69fb4a6..5c85803 100644 --- a/pkg/cloudapi/k8s/get_worker_nodes_meta_data.go +++ b/pkg/cloudapi/k8s/get_worker_nodes_meta_data.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get worker group metadata by ID +// GetWorkerNodesMetaDataRequest struct to get worker group metadata by ID type GetWorkerNodesMetaDataRequest struct { // Kubernetes cluster ID // Required: true @@ -18,13 +18,11 @@ type GetWorkerNodesMetaDataRequest struct { WorkersGroupID uint64 `url:"workersGroupId" json:"workersGroupId" validate:"required"` } -// Get worker group metadata by ID +// GetWorkerNodesMetaData gets worker group metadata by ID func (k K8S) GetWorkerNodesMetaData(ctx context.Context, req GetWorkerNodesMetaDataRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/getWorkerNodesMetaData" diff --git a/pkg/cloudapi/k8s/list_deleted.go b/pkg/cloudapi/k8s/list_deleted.go index ddb45d1..98317e1 100644 --- a/pkg/cloudapi/k8s/list_deleted.go +++ b/pkg/cloudapi/k8s/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted kubernetes cluster +// ListDeletedRequest struct to get list of deleted kubernetes cluster type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudapi/k8s/restore.go b/pkg/cloudapi/k8s/restore.go index 75fc3d4..9af326a 100644 --- a/pkg/cloudapi/k8s/restore.go +++ b/pkg/cloudapi/k8s/restore.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore kubernetes cluster +// RestoreRequest struct to restore kubernetes cluster type RestoreRequest struct { // Kubernetes cluster ID // Required: true K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"` } -// Restore restore kubernetes cluster from Recycle Bin +// Restore restores kubernetes cluster from Recycle Bin func (k8s K8S) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/restore" diff --git a/pkg/cloudapi/k8s/start.go b/pkg/cloudapi/k8s/start.go index a35add7..6854bae 100644 --- a/pkg/cloudapi/k8s/start.go +++ b/pkg/cloudapi/k8s/start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start kubernetes cluster +// StartRequest struct to start kubernetes cluster type StartRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type StartRequest struct { func (k8s K8S) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/start" diff --git a/pkg/cloudapi/k8s/stop.go b/pkg/cloudapi/k8s/stop.go index 07e50e7..14016e1 100644 --- a/pkg/cloudapi/k8s/stop.go +++ b/pkg/cloudapi/k8s/stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop kubernetes cluster +// StopRequest struct to stop kubernetes cluster type StopRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type StopRequest struct { func (k8s K8S) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/stop" diff --git a/pkg/cloudapi/k8s/update.go b/pkg/cloudapi/k8s/update.go index 588856b..07f9299 100644 --- a/pkg/cloudapi/k8s/update.go +++ b/pkg/cloudapi/k8s/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update kubernetes cluster +// UpdateRequest struct to update kubernetes cluster type UpdateRequest struct { // Kubernetes cluster ID // Required: true @@ -29,9 +29,7 @@ type UpdateRequest struct { func (k8s K8S) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/update" diff --git a/pkg/cloudapi/k8s/update_worker_nodes_meta_data.go b/pkg/cloudapi/k8s/update_worker_nodes_meta_data.go index 42ca590..6b1a0f8 100644 --- a/pkg/cloudapi/k8s/update_worker_nodes_meta_data.go +++ b/pkg/cloudapi/k8s/update_worker_nodes_meta_data.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add worker to a kubernetes cluster +// UpdateWorkerNodesMetaDataRequest struct to add worker to a kubernetes cluster type UpdateWorkerNodesMetaDataRequest struct { // Kubernetes cluster ID // Required: true @@ -23,13 +23,11 @@ type UpdateWorkerNodesMetaDataRequest struct { UserData string `url:"userData" json:"userData" validate:"required"` } -// WorkerAdd adds worker nodes to a kubernetes cluster +// UpdateWorkerNodesMetaData adds worker nodes to a kubernetes cluster func (k K8S) UpdateWorkerNodesMetaData(ctx context.Context, req UpdateWorkerNodesMetaDataRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/updateWorkerNodesMetaData" diff --git a/pkg/cloudapi/k8s/worker_add.go b/pkg/cloudapi/k8s/worker_add.go index 812584e..3ea4f13 100644 --- a/pkg/cloudapi/k8s/worker_add.go +++ b/pkg/cloudapi/k8s/worker_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add worker to a kubernetes cluster +// WorkerAddRequest struct to add worker to a kubernetes cluster type WorkerAddRequest struct { // Kubernetes cluster ID // Required: true @@ -23,13 +23,11 @@ type WorkerAddRequest struct { Num uint64 `url:"num,omitempty" json:"num,omitempty"` } -// WorkerAdd add worker nodes to a Kubernetes cluster +// WorkerAdd adds worker nodes to a Kubernetes cluster func (k8s K8S) WorkerAdd(ctx context.Context, req WorkerAddRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/workerAdd" diff --git a/pkg/cloudapi/k8s/worker_reset.go b/pkg/cloudapi/k8s/worker_reset.go index 24d7bc5..8c861bb 100644 --- a/pkg/cloudapi/k8s/worker_reset.go +++ b/pkg/cloudapi/k8s/worker_reset.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for hard reset kubernetes cluster +// WorkerResetRequest struct for hard reset kubernetes cluster type WorkerResetRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type WorkerResetRequest struct { func (k8s K8S) WorkerReset(ctx context.Context, req WorkerResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/workerReset" diff --git a/pkg/cloudapi/k8s/worker_restart.go b/pkg/cloudapi/k8s/worker_restart.go index 86aa205..58a4a2c 100644 --- a/pkg/cloudapi/k8s/worker_restart.go +++ b/pkg/cloudapi/k8s/worker_restart.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restart worker node +// WorkerRestartRequest struct to restart worker node type WorkerRestartRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type WorkerRestartRequest struct { func (k8s K8S) WorkerRestart(ctx context.Context, req WorkerRestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/workerRestart" diff --git a/pkg/cloudapi/k8s/workers_group_add.go b/pkg/cloudapi/k8s/workers_group_add.go index 843d7e1..426f37a 100644 --- a/pkg/cloudapi/k8s/workers_group_add.go +++ b/pkg/cloudapi/k8s/workers_group_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add workers group +// WorkersGroupAddRequest struct to add workers group type WorkersGroupAddRequest struct { // Kubernetes cluster ID // Required: true @@ -66,9 +66,7 @@ type WorkersGroupAddRequest struct { func (k8s K8S) WorkersGroupAdd(ctx context.Context, req WorkersGroupAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/workersGroupAdd" diff --git a/pkg/cloudapi/k8s/workers_group_delete.go b/pkg/cloudapi/k8s/workers_group_delete.go index 2de143d..ab6d4c8 100644 --- a/pkg/cloudapi/k8s/workers_group_delete.go +++ b/pkg/cloudapi/k8s/workers_group_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete workers group +// WorkersGroupDeleteRequest struct to delete workers group type WorkersGroupDeleteRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type WorkersGroupDeleteRequest struct { func (k8s K8S) WorkersGroupDelete(ctx context.Context, req WorkersGroupDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/workersGroupDelete" diff --git a/pkg/cloudapi/k8s/workers_group_get_by_name.go b/pkg/cloudapi/k8s/workers_group_get_by_name.go index 6ec0e5c..bd8db52 100644 --- a/pkg/cloudapi/k8s/workers_group_get_by_name.go +++ b/pkg/cloudapi/k8s/workers_group_get_by_name.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get information about worker group +// WorkersGroupGetByNameRequest struct to get information about worker group type WorkersGroupGetByNameRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type WorkersGroupGetByNameRequest struct { func (k8s K8S) WorkersGroupGetByName(ctx context.Context, req WorkersGroupGetByNameRequest) (*ItemK8SGroup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/k8s/workersGroupGetByName" diff --git a/pkg/cloudapi/kvmppc/create.go b/pkg/cloudapi/kvmppc/create.go index b9bf0e9..3fa59e8 100644 --- a/pkg/cloudapi/kvmppc/create.go +++ b/pkg/cloudapi/kvmppc/create.go @@ -26,7 +26,7 @@ type Interface struct { IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` } -// Request struct for create KVM PowerPC VM +// CreateRequest struct to create KVM PowerPC VM type CreateRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -99,9 +99,7 @@ type wrapperCreateRequest struct { func (k KVMPPC) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudapi/kvmppc/create_blank.go b/pkg/cloudapi/kvmppc/create_blank.go index 2967e6e..c0b1873 100644 --- a/pkg/cloudapi/kvmppc/create_blank.go +++ b/pkg/cloudapi/kvmppc/create_blank.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create KVM PowerPC VM from scratch +// CreateBlankRequest struct to create KVM PowerPC VM from scratch type CreateBlankRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -61,9 +61,7 @@ type wrapperCreateBlankRequest struct { func (k KVMPPC) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudapi/kvmx86/create.go b/pkg/cloudapi/kvmx86/create.go index 60374db..8d44ea3 100644 --- a/pkg/cloudapi/kvmx86/create.go +++ b/pkg/cloudapi/kvmx86/create.go @@ -26,7 +26,7 @@ type Interface struct { IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` } -// Request struct for create KVM x86 VM +// CreateRequest struct to create KVM x86 VM type CreateRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -107,9 +107,7 @@ type wrapperCreateRequest struct { func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudapi/kvmx86/create_blank.go b/pkg/cloudapi/kvmx86/create_blank.go index 6a71133..9c57ece 100644 --- a/pkg/cloudapi/kvmx86/create_blank.go +++ b/pkg/cloudapi/kvmx86/create_blank.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create KVM x86 VM from scratch +// CreateBlankRequest struct to create KVM x86 VM from scratch type CreateBlankRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -65,9 +65,7 @@ type wrapperCreateBlankRequest struct { func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudapi/lb/backend_create.go b/pkg/cloudapi/lb/backend_create.go index a7aa9bb..1b2c3d8 100644 --- a/pkg/cloudapi/lb/backend_create.go +++ b/pkg/cloudapi/lb/backend_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create backend +// BackendCreateRequest struct to create backend type BackendCreateRequest struct { // ID of the load balancer instance to backendCreate // Required: true @@ -71,9 +71,7 @@ type BackendCreateRequest struct { func (l LB) BackendCreate(ctx context.Context, req BackendCreateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/backendCreate" diff --git a/pkg/cloudapi/lb/backend_delete.go b/pkg/cloudapi/lb/backend_delete.go index cc21ffb..6c81cb2 100644 --- a/pkg/cloudapi/lb/backend_delete.go +++ b/pkg/cloudapi/lb/backend_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete backend +// BackendDeleteRequest struct to delete backend type BackendDeleteRequest struct { // ID of the load balancer instance to BackendDelete // Required: true @@ -24,9 +24,7 @@ type BackendDeleteRequest struct { func (l LB) BackendDelete(ctx context.Context, req BackendDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/backendDelete" diff --git a/pkg/cloudapi/lb/backend_server_add.go b/pkg/cloudapi/lb/backend_server_add.go index a2f3d51..e81cfeb 100644 --- a/pkg/cloudapi/lb/backend_server_add.go +++ b/pkg/cloudapi/lb/backend_server_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add server definition to the backend +// BackendServerAddRequest struct to add server definition to the backend type BackendServerAddRequest struct { // ID of the load balancer instance to BackendServerAdd // Required: true @@ -76,9 +76,7 @@ type BackendServerAddRequest struct { func (l LB) BackendServerAdd(ctx context.Context, req BackendServerAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/backendServerAdd" diff --git a/pkg/cloudapi/lb/backend_server_delete.go b/pkg/cloudapi/lb/backend_server_delete.go index 1c99281..3c7e43c 100644 --- a/pkg/cloudapi/lb/backend_server_delete.go +++ b/pkg/cloudapi/lb/backend_server_delete.go @@ -8,13 +8,13 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete server definition +// BackendServerDeleteRequest struct to delete server definition type BackendServerDeleteRequest struct { // ID of the load balancer instance to BackendServerDelete // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` - // Must match one of the existing backens - name of the backend to add servers to + // Must match one of the existing backends - name of the backend to add servers to // Required: true BackendName string `url:"backendName" json:"backendName" validate:"required"` @@ -28,9 +28,7 @@ type BackendServerDeleteRequest struct { func (l LB) BackendServerDelete(ctx context.Context, req BackendServerDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/backendServerDelete" diff --git a/pkg/cloudapi/lb/backend_server_update.go b/pkg/cloudapi/lb/backend_server_update.go index c2894ec..5c6949f 100644 --- a/pkg/cloudapi/lb/backend_server_update.go +++ b/pkg/cloudapi/lb/backend_server_update.go @@ -8,13 +8,13 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update server +// BackendServerUpdateRequest struct to update server type BackendServerUpdateRequest struct { // ID of the load balancer instance to BackendServerAdd // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` - // Must match one of the existing backens - name of the backend to add servers to + // Must match one of the existing backends - name of the backend to add servers to // Required: true BackendName string `url:"backendName" json:"backendName" validate:"required"` @@ -76,9 +76,7 @@ type BackendServerUpdateRequest struct { func (l LB) BackendServerUpdate(ctx context.Context, req BackendServerUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/backendServerUpdate" diff --git a/pkg/cloudapi/lb/backend_update.go b/pkg/cloudapi/lb/backend_update.go index 3aff5e9..6e7a63e 100644 --- a/pkg/cloudapi/lb/backend_update.go +++ b/pkg/cloudapi/lb/backend_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update backend +// BackendUpdateRequest struct to update backend type BackendUpdateRequest struct { // ID of the load balancer instance to backendCreate // Required: true @@ -71,9 +71,7 @@ type BackendUpdateRequest struct { func (l LB) BackendUpdate(ctx context.Context, req BackendUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/backendUpdate" diff --git a/pkg/cloudapi/lb/config_reset.go b/pkg/cloudapi/lb/config_reset.go index b9a356a..9a80e21 100644 --- a/pkg/cloudapi/lb/config_reset.go +++ b/pkg/cloudapi/lb/config_reset.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reset config +// ConfigResetRequest struct for reset config type ConfigResetRequest struct { // ID of the load balancer instance to ConfigReset // Required: true @@ -20,9 +20,7 @@ type ConfigResetRequest struct { func (l LB) ConfigReset(ctx context.Context, req ConfigResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/configReset" diff --git a/pkg/cloudapi/lb/create.go b/pkg/cloudapi/lb/create.go index d2d637e..ecab87c 100644 --- a/pkg/cloudapi/lb/create.go +++ b/pkg/cloudapi/lb/create.go @@ -12,7 +12,7 @@ import ( type Params []string -// Request struct for create load balancer +// CreateRequest struct to create load balancer type CreateRequest struct { // ID of the resource group where this load balancer instance will be located // Required: true @@ -57,9 +57,7 @@ type wrapperCreateRequest struct { func (l LB) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } if req.ExtNetID == 0 && req.VINSID == 0 { diff --git a/pkg/cloudapi/lb/delete.go b/pkg/cloudapi/lb/delete.go index 48f945a..2c35a03 100644 --- a/pkg/cloudapi/lb/delete.go +++ b/pkg/cloudapi/lb/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete load balancer +// DeleteRequest struct to delete load balancer type DeleteRequest struct { // ID of the load balancer instance to delete // Required: true @@ -23,9 +23,7 @@ type DeleteRequest struct { func (l LB) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/delete" diff --git a/pkg/cloudapi/lb/disable_enable.go b/pkg/cloudapi/lb/disable_enable.go index b0b7771..34ee9bb 100644 --- a/pkg/cloudapi/lb/disable_enable.go +++ b/pkg/cloudapi/lb/disable_enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable/enable load balancer +// DisableEnableRequest struct for disable/enable load balancer type DisableEnableRequest struct { // ID of the load balancer instance to disable/enable // Required: true @@ -19,9 +19,7 @@ type DisableEnableRequest struct { func (l LB) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/disable" @@ -43,9 +41,7 @@ func (l LB) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) func (l LB) Enable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/enable" diff --git a/pkg/cloudapi/lb/frontend_bind.go b/pkg/cloudapi/lb/frontend_bind.go index f182dd4..965eb6f 100644 --- a/pkg/cloudapi/lb/frontend_bind.go +++ b/pkg/cloudapi/lb/frontend_bind.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for frontend bind +// FrontendBindRequest struct for frontend bind type FrontendBindRequest struct { // ID of the load balancer instance to FrontendBind // Required: true @@ -38,9 +38,7 @@ type FrontendBindRequest struct { func (l LB) FrontendBind(ctx context.Context, req FrontendBindRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/frontendBind" diff --git a/pkg/cloudapi/lb/frontend_bind_delete.go b/pkg/cloudapi/lb/frontend_bind_delete.go index 5538b9b..c6540c9 100644 --- a/pkg/cloudapi/lb/frontend_bind_delete.go +++ b/pkg/cloudapi/lb/frontend_bind_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete bind +// FrontendBindDeleteRequest struct to delete bind type FrontendBindDeleteRequest struct { // ID of the load balancer instance to FrontendBindDelete // Required: true @@ -27,9 +27,7 @@ type FrontendBindDeleteRequest struct { func (l LB) FrontendBindDelete(ctx context.Context, req FrontendBindDeleteRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/frontendBindDelete" diff --git a/pkg/cloudapi/lb/frontend_bind_update.go b/pkg/cloudapi/lb/frontend_bind_update.go index 54a6d69..fcfd1e8 100644 --- a/pkg/cloudapi/lb/frontend_bind_update.go +++ b/pkg/cloudapi/lb/frontend_bind_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update binding +// FrontendBindUpdateRequest struct to update binding type FrontendBindUpdateRequest struct { // ID of the load balancer instance to FrontendBindUpdate // Required: true @@ -38,9 +38,7 @@ type FrontendBindUpdateRequest struct { func (l LB) FrontendBindUpdate(ctx context.Context, req FrontendBindUpdateRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/frontendBindingUpdate" diff --git a/pkg/cloudapi/lb/frontend_create.go b/pkg/cloudapi/lb/frontend_create.go index a5d5600..9e8e0b3 100644 --- a/pkg/cloudapi/lb/frontend_create.go +++ b/pkg/cloudapi/lb/frontend_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create frontend +// FrontendCreateRequest struct to create frontend type FrontendCreateRequest struct { // ID of the load balancer instance to FrontendCreate // Required: true @@ -29,9 +29,7 @@ type FrontendCreateRequest struct { func (l LB) FrontendCreate(ctx context.Context, req FrontendCreateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/frontendCreate" diff --git a/pkg/cloudapi/lb/frontend_delete.go b/pkg/cloudapi/lb/frontend_delete.go index b4cc068..fa65560 100644 --- a/pkg/cloudapi/lb/frontend_delete.go +++ b/pkg/cloudapi/lb/frontend_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete frontend +// FrontendDeleteRequest struct to delete frontend type FrontendDeleteRequest struct { // ID of the load balancer instance to FrontendDelete // Required: true @@ -24,9 +24,7 @@ type FrontendDeleteRequest struct { func (l LB) FrontendDelete(ctx context.Context, req FrontendDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/frontendDelete" diff --git a/pkg/cloudapi/lb/get.go b/pkg/cloudapi/lb/get.go index 983958f..b870b93 100644 --- a/pkg/cloudapi/lb/get.go +++ b/pkg/cloudapi/lb/get.go @@ -36,9 +36,7 @@ func (l LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) { func (l LB) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/get" diff --git a/pkg/cloudapi/lb/list_deleted.go b/pkg/cloudapi/lb/list_deleted.go index 37b3cc9..5a6040e 100644 --- a/pkg/cloudapi/lb/list_deleted.go +++ b/pkg/cloudapi/lb/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list of deleted load balancers +// ListDeletedRequest struct to get list of deleted load balancers type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudapi/lb/make_highly_available.go b/pkg/cloudapi/lb/make_highly_available.go index ad2b88c..378224a 100644 --- a/pkg/cloudapi/lb/make_highly_available.go +++ b/pkg/cloudapi/lb/make_highly_available.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for make Load Balancer Highly available +// HighlyAvailableRequest struct to make Load Balancer Highly available type HighlyAvailableRequest struct { // ID of the LB instance // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` } -// Make Load Balancer Highly available +// HighlyAvailable makes load balancer highly available func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/makeHighlyAvailable" diff --git a/pkg/cloudapi/lb/restart.go b/pkg/cloudapi/lb/restart.go index 56574b5..67e148e 100644 --- a/pkg/cloudapi/lb/restart.go +++ b/pkg/cloudapi/lb/restart.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restart load balancer +// RestartRequest struct to restart load balancer type RestartRequest struct { // ID of the load balancer instance to restart // Required: true @@ -19,9 +19,7 @@ type RestartRequest struct { func (l LB) Restart(ctx context.Context, req RestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/restart" diff --git a/pkg/cloudapi/lb/restore.go b/pkg/cloudapi/lb/restore.go index 2b73254..287d090 100644 --- a/pkg/cloudapi/lb/restore.go +++ b/pkg/cloudapi/lb/restore.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore load balancer +// RestoreRequest struct to restore load balancer type RestoreRequest struct { // ID of the load balancer instance to restore // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` } -// Restore restore load balancer from recycle bin +// Restore restores load balancer from recycle bin func (l LB) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/restore" diff --git a/pkg/cloudapi/lb/start.go b/pkg/cloudapi/lb/start.go index 9541b0f..b13af0f 100644 --- a/pkg/cloudapi/lb/start.go +++ b/pkg/cloudapi/lb/start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start load balancer +// StartRequest struct to start load balancer type StartRequest struct { // ID of the load balancer instance to start // Required: true @@ -19,9 +19,7 @@ type StartRequest struct { func (l LB) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/start" diff --git a/pkg/cloudapi/lb/stop.go b/pkg/cloudapi/lb/stop.go index efda2cc..8010030 100644 --- a/pkg/cloudapi/lb/stop.go +++ b/pkg/cloudapi/lb/stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop load balancer +// StopRequest struct to stop load balancer type StopRequest struct { // ID of the load balancer instance to stop // Required: true @@ -19,9 +19,7 @@ type StopRequest struct { func (l LB) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/start" diff --git a/pkg/cloudapi/lb/update.go b/pkg/cloudapi/lb/update.go index 9178481..fd15c00 100644 --- a/pkg/cloudapi/lb/update.go +++ b/pkg/cloudapi/lb/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update load balancer +// UpdateRequest struct to update load balancer type UpdateRequest struct { // ID of the load balancer to update // Required: true @@ -24,9 +24,7 @@ type UpdateRequest struct { func (l LB) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/lb/update" diff --git a/pkg/cloudapi/lb/updateSysctParams.go b/pkg/cloudapi/lb/updateSysctParams.go index d50ea95..37c29e9 100644 --- a/pkg/cloudapi/lb/updateSysctParams.go +++ b/pkg/cloudapi/lb/updateSysctParams.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update sysct params for lb +// UpdateSysctParamsRequest struct to update sysct params for lb type UpdateSysctParamsRequest struct { // ID of the LB instance // Required: true @@ -25,13 +25,11 @@ type wrapperUpdateSysctParamsRequest struct { Params []string `url:"sysctlParams" validate:"required"` } -// Create method will create a new load balancer instance +// UpdateSysctParams updates sysct paarams for lb func (l LB) UpdateSysctParams(ctx context.Context, req UpdateSysctParamsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } var params []string diff --git a/pkg/cloudapi/rg/access_grant.go b/pkg/cloudapi/rg/access_grant.go index 65c25c8..332ebf7 100644 --- a/pkg/cloudapi/rg/access_grant.go +++ b/pkg/cloudapi/rg/access_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to resource group +// AccessGrantRequest struct to grant access to resource group type AccessGrantRequest struct { // Resource group ID // Required: true @@ -34,9 +34,7 @@ type AccessGrantRequest struct { func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/accessGrant" diff --git a/pkg/cloudapi/rg/access_revoke.go b/pkg/cloudapi/rg/access_revoke.go index 3182f98..3d8e51a 100644 --- a/pkg/cloudapi/rg/access_revoke.go +++ b/pkg/cloudapi/rg/access_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access +// AccessRevokeRequest struct to revoke access type AccessRevokeRequest struct { // Resource group ID // Required: true @@ -27,9 +27,7 @@ type AccessRevokeRequest struct { func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/accessRevoke" diff --git a/pkg/cloudapi/rg/affinity_group_computes.go b/pkg/cloudapi/rg/affinity_group_computes.go index 28db0c3..ba67443 100644 --- a/pkg/cloudapi/rg/affinity_group_computes.go +++ b/pkg/cloudapi/rg/affinity_group_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of all computes with their relationships +// AffinityGroupComputesRequest struct to get list of all computes with their relationships type AffinityGroupComputesRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type AffinityGroupComputesRequest struct { func (r RG) AffinityGroupComputes(ctx context.Context, req AffinityGroupComputesRequest) (ListAffinityGroupsComputes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/affinityGroupComputes" diff --git a/pkg/cloudapi/rg/affinity_groups_get.go b/pkg/cloudapi/rg/affinity_groups_get.go index 326f598..6c8f2bc 100644 --- a/pkg/cloudapi/rg/affinity_groups_get.go +++ b/pkg/cloudapi/rg/affinity_groups_get.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list computes from affinity group +// AffinityGroupsGetRequest struct to get list computes from affinity group type AffinityGroupsGetRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type AffinityGroupsGetRequest struct { func (r RG) AffinityGroupsGet(ctx context.Context, req AffinityGroupsGetRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/affinityGroupsGet" diff --git a/pkg/cloudapi/rg/affinity_groups_list.go b/pkg/cloudapi/rg/affinity_groups_list.go index 458fcca..ab72627 100644 --- a/pkg/cloudapi/rg/affinity_groups_list.go +++ b/pkg/cloudapi/rg/affinity_groups_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of affinity groups from resource group +// AffinityGroupsListRequest struct to get list of affinity groups from resource group type AffinityGroupsListRequest struct { // Resource group ID // Required: true @@ -27,9 +27,7 @@ type AffinityGroupsListRequest struct { func (r RG) AffinityGroupsList(ctx context.Context, req AffinityGroupsListRequest) (*ListAffinityGroups, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/affinityGroupsList" diff --git a/pkg/cloudapi/rg/audits.go b/pkg/cloudapi/rg/audits.go index 5915c1d..8cbe016 100644 --- a/pkg/cloudapi/rg/audits.go +++ b/pkg/cloudapi/rg/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get audit +// AuditsRequest struct to get audit type AuditsRequest struct { // Resource group ID // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (r RG) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/audits" diff --git a/pkg/cloudapi/rg/create.go b/pkg/cloudapi/rg/create.go index 88a6379..78a3194 100644 --- a/pkg/cloudapi/rg/create.go +++ b/pkg/cloudapi/rg/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create resource group +// CreateRequest struct to create resource group type CreateRequest struct { // Account, which will own this resource group // Required: true @@ -85,9 +85,7 @@ type CreateRequest struct { func (r RG) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/create" diff --git a/pkg/cloudapi/rg/delete.go b/pkg/cloudapi/rg/delete.go index 95457bc..ceac5c6 100644 --- a/pkg/cloudapi/rg/delete.go +++ b/pkg/cloudapi/rg/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete resource group +// DeleteRequest struct to delete resource group type DeleteRequest struct { // Resource group ID // Required: true @@ -32,9 +32,7 @@ type DeleteRequest struct { func (r RG) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/delete" diff --git a/pkg/cloudapi/rg/disable.go b/pkg/cloudapi/rg/disable.go index d86a47d..f4d2c73 100644 --- a/pkg/cloudapi/rg/disable.go +++ b/pkg/cloudapi/rg/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable resource group +// DisableRequest struct to disable resource group type DisableRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type DisableRequest struct { func (r RG) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/disable" diff --git a/pkg/cloudapi/rg/enable.go b/pkg/cloudapi/rg/enable.go index f08c807..f1784f1 100644 --- a/pkg/cloudapi/rg/enable.go +++ b/pkg/cloudapi/rg/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable resource group +// EnableRequest struct to enable resource group type EnableRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type EnableRequest struct { func (r RG) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/enable" diff --git a/pkg/cloudapi/rg/get.go b/pkg/cloudapi/rg/get.go index db23ec3..523049d 100644 --- a/pkg/cloudapi/rg/get.go +++ b/pkg/cloudapi/rg/get.go @@ -40,9 +40,7 @@ func (r RG) Get(ctx context.Context, req GetRequest) (*RecordResourceGroup, erro func (r RG) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/get" diff --git a/pkg/cloudapi/rg/get_resource_consumption.go b/pkg/cloudapi/rg/get_resource_consumption.go index 9217737..21fd175 100644 --- a/pkg/cloudapi/rg/get_resource_consumption.go +++ b/pkg/cloudapi/rg/get_resource_consumption.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get detailed information about resource consumption for ResGroup +// GetResourceConsumptionRequest struct to get detailed information about resource consumption for ResGroup type GetResourceConsumptionRequest struct { // Resource group ID // Required: true @@ -19,9 +19,7 @@ type GetResourceConsumptionRequest struct { func (r RG) GetResourceConsumption(ctx context.Context, req GetResourceConsumptionRequest) (*ItemResourceConsumption, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/getResourceConsumption" diff --git a/pkg/cloudapi/rg/list_computes.go b/pkg/cloudapi/rg/list_computes.go index ceee176..78ef722 100644 --- a/pkg/cloudapi/rg/list_computes.go +++ b/pkg/cloudapi/rg/list_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of computes +// ListComputesRequest struct to get list of computes type ListComputesRequest struct { // Resource group ID // Required: true @@ -59,9 +59,7 @@ type ListComputesRequest struct { func (r RG) ListComputes(ctx context.Context, req ListComputesRequest) (*ListComputes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/listComputes" diff --git a/pkg/cloudapi/rg/list_deleted.go b/pkg/cloudapi/rg/list_deleted.go index 49801f6..e7e1ac2 100644 --- a/pkg/cloudapi/rg/list_deleted.go +++ b/pkg/cloudapi/rg/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted resource groups +// ListDeletedRequest struct to get list deleted resource groups type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudapi/rg/list_lb.go b/pkg/cloudapi/rg/list_lb.go index 3b58e44..ae7a6ff 100644 --- a/pkg/cloudapi/rg/list_lb.go +++ b/pkg/cloudapi/rg/list_lb.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list load balancers +// ListLBRequest struct to get list of load balancers type ListLBRequest struct { // Resource group ID // Required: true @@ -55,9 +55,7 @@ type ListLBRequest struct { func (r RG) ListLB(ctx context.Context, req ListLBRequest) (*ListLB, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/listLb" diff --git a/pkg/cloudapi/rg/list_pfw.go b/pkg/cloudapi/rg/list_pfw.go index dfc5c1c..b109748 100644 --- a/pkg/cloudapi/rg/list_pfw.go +++ b/pkg/cloudapi/rg/list_pfw.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list port forward rules +// ListPFWRequest struct to get list of port forward rules type ListPFWRequest struct { // Resource group ID // Required: true @@ -19,9 +19,7 @@ type ListPFWRequest struct { func (r RG) ListPFW(ctx context.Context, req ListPFWRequest) (*ListPortForwards, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/listPFW" diff --git a/pkg/cloudapi/rg/list_vins.go b/pkg/cloudapi/rg/list_vins.go index 6312b33..0cb4aa5 100644 --- a/pkg/cloudapi/rg/list_vins.go +++ b/pkg/cloudapi/rg/list_vins.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list VINSes +// ListVINSRequest struct to get list of VINSes type ListVINSRequest struct { // Resource group ID // Required: true @@ -43,9 +43,7 @@ type ListVINSRequest struct { func (r RG) ListVINS(ctx context.Context, req ListVINSRequest) (*ListVINS, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/listVins" diff --git a/pkg/cloudapi/rg/restore.go b/pkg/cloudapi/rg/restore.go index 7aaed7b..b657380 100644 --- a/pkg/cloudapi/rg/restore.go +++ b/pkg/cloudapi/rg/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore resource group +// RestoreRequest struct to restore resource group type RestoreRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type RestoreRequest struct { func (r RG) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/restore" diff --git a/pkg/cloudapi/rg/set_def_net.go b/pkg/cloudapi/rg/set_def_net.go index 91258ab..cdab42c 100644 --- a/pkg/cloudapi/rg/set_def_net.go +++ b/pkg/cloudapi/rg/set_def_net.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set default network +// SetDefNetRequest struct to set default network type SetDefNetRequest struct { // Resource group ID // Required: true @@ -34,9 +34,7 @@ type SetDefNetRequest struct { func (r RG) SetDefNet(ctx context.Context, req SetDefNetRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/setDefNet" diff --git a/pkg/cloudapi/rg/update.go b/pkg/cloudapi/rg/update.go index 7f7e390..3480f57 100644 --- a/pkg/cloudapi/rg/update.go +++ b/pkg/cloudapi/rg/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update resource group +// UpdateRequest struct to update resource group type UpdateRequest struct { // Resource group ID // Required: true @@ -55,9 +55,7 @@ type UpdateRequest struct { func (r RG) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/update" diff --git a/pkg/cloudapi/rg/usage.go b/pkg/cloudapi/rg/usage.go index 7a3b257..d830414 100644 --- a/pkg/cloudapi/rg/usage.go +++ b/pkg/cloudapi/rg/usage.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get report of resource usage +// UsageRequest struct to get report of resource usage type UsageRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type UsageRequest struct { func (r RG) Usage(ctx context.Context, req UsageRequest) (*RecordResourceUsage, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/rg/usage" diff --git a/pkg/cloudapi/stack/get.go b/pkg/cloudapi/stack/get.go index 66cbd93..d257dcc 100644 --- a/pkg/cloudapi/stack/get.go +++ b/pkg/cloudapi/stack/get.go @@ -36,9 +36,7 @@ func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) { func (i Stack) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/stack/get" diff --git a/pkg/cloudapi/tasks/get.go b/pkg/cloudapi/tasks/get.go index 883c7a4..dad1373 100644 --- a/pkg/cloudapi/tasks/get.go +++ b/pkg/cloudapi/tasks/get.go @@ -37,9 +37,7 @@ func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordAsyncTask, error func (t Tasks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/tasks/get" diff --git a/pkg/cloudapi/vins/audits.go b/pkg/cloudapi/vins/audits.go index ad59ab5..8288dbe 100644 --- a/pkg/cloudapi/vins/audits.go +++ b/pkg/cloudapi/vins/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get audits +// AuditsRequest struct to get audits type AuditsRequest struct { // ID of the VINS // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (v VINS) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/audits" diff --git a/pkg/cloudapi/vins/create_in_account.go b/pkg/cloudapi/vins/create_in_account.go index d1b6dce..cb00d66 100644 --- a/pkg/cloudapi/vins/create_in_account.go +++ b/pkg/cloudapi/vins/create_in_account.go @@ -20,7 +20,7 @@ type Route struct { Gateway string `url:"gateway" json:"gateway" validate:"required"` } -// Request struct for create VINS in account +// CreateInAccountRequest struct to create VINS in account type CreateInAccountRequest struct { // VINS name // Required: true @@ -60,9 +60,7 @@ type wrapperCreateRequestInAcc struct { func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var routes []string diff --git a/pkg/cloudapi/vins/create_in_rg.go b/pkg/cloudapi/vins/create_in_rg.go index a71bcbb..e24f7d4 100644 --- a/pkg/cloudapi/vins/create_in_rg.go +++ b/pkg/cloudapi/vins/create_in_rg.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create VINS in resource group +// CreateInRGRequest struct to create VINS in resource group type CreateInRGRequest struct { // VINS name // Required: true @@ -53,9 +53,7 @@ type wrapperCreateRequestInRG struct { func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var routes []string diff --git a/pkg/cloudapi/vins/delete.go b/pkg/cloudapi/vins/delete.go index c9745e8..d6f9873 100644 --- a/pkg/cloudapi/vins/delete.go +++ b/pkg/cloudapi/vins/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete VINS +// DeleteRequest struct to delete VINS type DeleteRequest struct { // VINS ID // Required: true @@ -31,9 +31,7 @@ type DeleteRequest struct { func (v VINS) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/delete" diff --git a/pkg/cloudapi/vins/disable_enable.go b/pkg/cloudapi/vins/disable_enable.go index a238a14..1b91235 100644 --- a/pkg/cloudapi/vins/disable_enable.go +++ b/pkg/cloudapi/vins/disable_enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable/enable VINS +// DisableEnableRequest struct to disable/enable VINS type DisableEnableRequest struct { // VINS ID // Required: true @@ -19,9 +19,7 @@ type DisableEnableRequest struct { func (v VINS) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/disable" @@ -44,9 +42,7 @@ func (v VINS) Disable(ctx context.Context, req DisableEnableRequest) (bool, erro func (v VINS) Enable(ctx context.Context, req DisableEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/enable" diff --git a/pkg/cloudapi/vins/extnet_connect.go b/pkg/cloudapi/vins/extnet_connect.go index e2ef441..5bd8130 100644 --- a/pkg/cloudapi/vins/extnet_connect.go +++ b/pkg/cloudapi/vins/extnet_connect.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for connect external network +// ExtNetConnectRequest struct to connect to external network type ExtNetConnectRequest struct { // VINS ID // Required: true @@ -27,9 +27,7 @@ type ExtNetConnectRequest struct { func (v VINS) ExtNetConnect(ctx context.Context, req ExtNetConnectRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/extNetConnect" diff --git a/pkg/cloudapi/vins/extnet_disconnect.go b/pkg/cloudapi/vins/extnet_disconnect.go index 7bbe87f..69fe1a3 100644 --- a/pkg/cloudapi/vins/extnet_disconnect.go +++ b/pkg/cloudapi/vins/extnet_disconnect.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disconnect VINS from external network +// ExtNetDisconnectRequest struct to disconnect VINS from external network type ExtNetDisconnectRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// ExtNetDisconnect disconnect VINS from external network +// ExtNetDisconnect disconnects VINS from external network func (v VINS) ExtNetDisconnect(ctx context.Context, req ExtNetDisconnectRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/extNetDisconnect" diff --git a/pkg/cloudapi/vins/extnet_list.go b/pkg/cloudapi/vins/extnet_list.go index 0c8643e..3e6f729 100644 --- a/pkg/cloudapi/vins/extnet_list.go +++ b/pkg/cloudapi/vins/extnet_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list VINS external network connections +// ExtNetListRequest struct to get list of VINS external network connections type ExtNetListRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// ExtNetList show list of VINS external network connections +// ExtNetList shows list of VINS external network connections func (v VINS) ExtNetList(ctx context.Context, req ExtNetListRequest) (*ListExtNets, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/extNetList" diff --git a/pkg/cloudapi/vins/get.go b/pkg/cloudapi/vins/get.go index a7aec2a..8f0fb2e 100644 --- a/pkg/cloudapi/vins/get.go +++ b/pkg/cloudapi/vins/get.go @@ -36,9 +36,7 @@ func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) { func (v VINS) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/get" diff --git a/pkg/cloudapi/vins/ip_list.go b/pkg/cloudapi/vins/ip_list.go index d488655..0bedf5c 100644 --- a/pkg/cloudapi/vins/ip_list.go +++ b/pkg/cloudapi/vins/ip_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for DHCP IP +// IPListRequest struct for DHCP IP type IPListRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// IPList show DHCP IP reservations on VINS +// IPList shows DHCP IP reservations on VINS func (v VINS) IPList(ctx context.Context, req IPListRequest) (*ListIPs, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/ipList" diff --git a/pkg/cloudapi/vins/ip_release.go b/pkg/cloudapi/vins/ip_release.go index 4ac8151..c00adbb 100644 --- a/pkg/cloudapi/vins/ip_release.go +++ b/pkg/cloudapi/vins/ip_release.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for IP relese +// IPReleaseRequest struct for IP release type IPReleaseRequest struct { // VINS ID // Required: true @@ -28,9 +28,7 @@ type IPReleaseRequest struct { func (v VINS) IPRelese(ctx context.Context, req IPReleaseRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/ipRelease" diff --git a/pkg/cloudapi/vins/ip_reserve.go b/pkg/cloudapi/vins/ip_reserve.go index fd3b9c7..b741d29 100644 --- a/pkg/cloudapi/vins/ip_reserve.go +++ b/pkg/cloudapi/vins/ip_reserve.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for IP reserve +// IPReserveRequest struct for IP reserve type IPReserveRequest struct { // VINS ID // Required: true @@ -42,9 +42,7 @@ type IPReserveRequest struct { func (v VINS) IPReserve(ctx context.Context, req IPReserveRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/ipReserve" diff --git a/pkg/cloudapi/vins/list_deleted.go b/pkg/cloudapi/vins/list_deleted.go index d7d77f4..49f4426 100644 --- a/pkg/cloudapi/vins/list_deleted.go +++ b/pkg/cloudapi/vins/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list of deleted VINSes +// ListDeletedRequest struct to get list of deleted VINSes type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudapi/vins/nat_rule_add.go b/pkg/cloudapi/vins/nat_rule_add.go index c04076b..e5767ec 100644 --- a/pkg/cloudapi/vins/nat_rule_add.go +++ b/pkg/cloudapi/vins/nat_rule_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create NAT rules +// NATRuleAddRequest struct to create NAT rules type NATRuleAddRequest struct { // VINS ID // Required: true @@ -42,9 +42,7 @@ type NATRuleAddRequest struct { func (v VINS) NATRuleAdd(ctx context.Context, req NATRuleAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/natRuleAdd" diff --git a/pkg/cloudapi/vins/nat_rule_del.go b/pkg/cloudapi/vins/nat_rule_del.go index 787add8..35332fc 100644 --- a/pkg/cloudapi/vins/nat_rule_del.go +++ b/pkg/cloudapi/vins/nat_rule_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete NAT rule +// NATRuleDelRequest struct to delete NAT rule type NATRuleDelRequest struct { // VINS ID // Required: true @@ -20,13 +20,11 @@ type NATRuleDelRequest struct { RuleID int64 `url:"ruleId" json:"ruleId" validate:"required"` } -// NATRuleDel delete NAT (port forwarding) rule on VINS +// NATRuleDel deletes NAT (port forwarding) rule on VINS func (v VINS) NATRuleDel(ctx context.Context, req NATRuleDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/natRuleDel" diff --git a/pkg/cloudapi/vins/nat_rule_list.go b/pkg/cloudapi/vins/nat_rule_list.go index 57e2f4c..3eef007 100644 --- a/pkg/cloudapi/vins/nat_rule_list.go +++ b/pkg/cloudapi/vins/nat_rule_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of NAT rules +// NATRuleListRequest struct to get list of NAT rules type NATRuleListRequest struct { // VINS ID // Required: true @@ -19,9 +19,7 @@ type NATRuleListRequest struct { func (v VINS) NATRuleList(ctx context.Context, req NATRuleListRequest) (*ListNATRules, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/natRuleList" diff --git a/pkg/cloudapi/vins/restore.go b/pkg/cloudapi/vins/restore.go index 86ee4d0..8227737 100644 --- a/pkg/cloudapi/vins/restore.go +++ b/pkg/cloudapi/vins/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore +// RestoreRequest struct for restore type RestoreRequest struct { // VINS ID // Required: true @@ -19,9 +19,7 @@ type RestoreRequest struct { func (v VINS) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/restore" diff --git a/pkg/cloudapi/vins/search.go b/pkg/cloudapi/vins/search.go index b5a2508..d8efec9 100644 --- a/pkg/cloudapi/vins/search.go +++ b/pkg/cloudapi/vins/search.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for search VINSes +// SearchRequest struct for search VINSes type SearchRequest struct { // ID of the account to search for the ViNSes // Required: false @@ -25,7 +25,7 @@ type SearchRequest struct { ShowAll bool `url:"show_all,omitempty" json:"show_all,omitempty"` } -// Search search VINSes +// Search searches VINSes func (v VINS) Search(ctx context.Context, req SearchRequest) (SearchListVINS, error) { url := "/cloudapi/vins/search" diff --git a/pkg/cloudapi/vins/static_route_access_grant.go b/pkg/cloudapi/vins/static_route_access_grant.go index e8cfea8..03cbe7d 100644 --- a/pkg/cloudapi/vins/static_route_access_grant.go +++ b/pkg/cloudapi/vins/static_route_access_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to static route to Compute/ViNS +// StaticRouteAccessGrantRequest struct to grant access to static route to Compute/ViNS type StaticRouteAccessGrantRequest struct { // ViNS ID to grant access // Required: true @@ -16,20 +16,18 @@ type StaticRouteAccessGrantRequest struct { // Route ID to grant access, can be found in staticRouteList // Required: true - RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` + RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` // List of Compute IDs to grant access to this route // Required: false ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// Grant access to static route to Compute/ViNS +// StaticRouteAccessGrant grants access to static route to Compute/ViNS func (v VINS) StaticRouteAccessGrant(ctx context.Context, req StaticRouteAccessGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/staticRouteAccessGrant" diff --git a/pkg/cloudapi/vins/static_route_access_revoke.go b/pkg/cloudapi/vins/static_route_access_revoke.go index 2c2f6ea..66e681e 100644 --- a/pkg/cloudapi/vins/static_route_access_revoke.go +++ b/pkg/cloudapi/vins/static_route_access_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to static route to Compute/ViNS +// StaticRouteAccessRevokeRequest struct to revoke access to static route to Compute/ViNS type StaticRouteAccessRevokeRequest struct { // ViNS ID to revoke access // Required: true @@ -16,20 +16,18 @@ type StaticRouteAccessRevokeRequest struct { // Route ID to revoke access, can be found in staticRouteList // Required: true - RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` + RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` // List of Compute IDs to revoke access to this route // Required: false ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// Revoke access to static route to Compute/ViNS +// StaticRouteAccessRevoke revokes access to static route to Compute/ViNS func (v VINS) StaticRouteAccessRevoke(ctx context.Context, req StaticRouteAccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/staticRouteAccessRevoke" diff --git a/pkg/cloudapi/vins/static_route_add.go b/pkg/cloudapi/vins/static_route_add.go index 1776e2d..67876aa 100644 --- a/pkg/cloudapi/vins/static_route_add.go +++ b/pkg/cloudapi/vins/static_route_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add static route +// StaticRouteAddRequest struct to add static route type StaticRouteAddRequest struct { // VINS ID // Required: true @@ -31,13 +31,11 @@ type StaticRouteAddRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// StaticRouteAdd add new static route to ViNS +// StaticRouteAdd adds new static route to ViNS func (v VINS) StaticRouteAdd(ctx context.Context, req StaticRouteAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/staticRouteAdd" diff --git a/pkg/cloudapi/vins/static_route_del.go b/pkg/cloudapi/vins/static_route_del.go index 6674e8d..0ba9818 100644 --- a/pkg/cloudapi/vins/static_route_del.go +++ b/pkg/cloudapi/vins/static_route_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove static route from ViNS +// StaticRouteDelRequest struct to remove static route from ViNS type StaticRouteDelRequest struct { // ViNS ID to remove static route from // Required: true @@ -16,16 +16,14 @@ type StaticRouteDelRequest struct { // Route ID to remove, can be found in staticRouteList // Required: true - RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` + RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` } -// Remove static route from ViNS +// StaticRouteDel removes static route from ViNS func (v VINS) StaticRouteDel(ctx context.Context, req StaticRouteDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/staticRouteDel" diff --git a/pkg/cloudapi/vins/static_route_list.go b/pkg/cloudapi/vins/static_route_list.go index 47f96e4..dd1eda1 100644 --- a/pkg/cloudapi/vins/static_route_list.go +++ b/pkg/cloudapi/vins/static_route_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for static route list +// StaticRouteListRequest struct for static route list type StaticRouteListRequest struct { // ViNS ID to show list of static routes // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// Show list of static routes for ViNS +// StaticRouteList shows list of static routes for ViNS func (v VINS) StaticRouteList(ctx context.Context, req StaticRouteListRequest) (*ListStaticRoutes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/staticRouteList" diff --git a/pkg/cloudapi/vins/vnfdev_redeploy.go b/pkg/cloudapi/vins/vnfdev_redeploy.go index 753d6ac..779a7c4 100644 --- a/pkg/cloudapi/vins/vnfdev_redeploy.go +++ b/pkg/cloudapi/vins/vnfdev_redeploy.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for redeploy VNFDevs +// VNFDevRedeployRequest struct for redeploy VNFDevs type VNFDevRedeployRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// VNFDevRedeploy redeploy VINS VNFDevs +// VNFDevRedeploy redeploys VINS VNFDevs func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/vnfdevRedeploy" diff --git a/pkg/cloudapi/vins/vnfdev_restart.go b/pkg/cloudapi/vins/vnfdev_restart.go index 3eecae8..37f052a 100644 --- a/pkg/cloudapi/vins/vnfdev_restart.go +++ b/pkg/cloudapi/vins/vnfdev_restart.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reboot VINSes primary VNF device +// VNFDevRestartRequest struct for reboot VINSes primary VNF device type VNFDevRestartRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// VNFDevRestart reboot VINSes primary VNF device +// VNFDevRestart reboots VINSes primary VNF device func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudapi/vins/vnfdevRestart" diff --git a/pkg/cloudbroker/account/add_user.go b/pkg/cloudbroker/account/add_user.go index f7f95ac..4da1f89 100644 --- a/pkg/cloudbroker/account/add_user.go +++ b/pkg/cloudbroker/account/add_user.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for adding permission to access to account for a user +// AddUserRequest struct for adding permission to access to account for a user type AddUserRequest struct { // ID of account to add to // Required: true @@ -30,9 +30,7 @@ type AddUserRequest struct { func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/addUser" diff --git a/pkg/cloudbroker/account/audits.go b/pkg/cloudbroker/account/audits.go index 3014f16..2e1169d 100644 --- a/pkg/cloudbroker/account/audits.go +++ b/pkg/cloudbroker/account/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for give list account audits +// AuditsRequest struct to give list of account audits type AuditsRequest struct { // ID of the account // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (a Account) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/audits" diff --git a/pkg/cloudbroker/account/create.go b/pkg/cloudbroker/account/create.go index 6f6df07..bcb8ff0 100644 --- a/pkg/cloudbroker/account/create.go +++ b/pkg/cloudbroker/account/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for creating account +// CreateRequest struct for creating account type CreateRequest struct { // Display name // Required: true @@ -61,9 +61,7 @@ type CreateRequest struct { func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/create" diff --git a/pkg/cloudbroker/account/delete.go b/pkg/cloudbroker/account/delete.go index 3becf47..4d97e10 100644 --- a/pkg/cloudbroker/account/delete.go +++ b/pkg/cloudbroker/account/delete.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete account +// DeleteRequest struct to delete account type DeleteRequest struct { // ID of account to delete // Required: true @@ -26,9 +26,7 @@ type DeleteRequest struct { func (a Account) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/delete" diff --git a/pkg/cloudbroker/account/delete_accounts.go b/pkg/cloudbroker/account/delete_accounts.go index 6ef2d7c..ad459a5 100644 --- a/pkg/cloudbroker/account/delete_accounts.go +++ b/pkg/cloudbroker/account/delete_accounts.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete group accounts +// DeleteAccountsRequest struct to delete group of accounts type DeleteAccountsRequest struct { // IDs of accounts // Required: true @@ -22,13 +22,11 @@ type DeleteAccountsRequest struct { Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"` } -// DeleteAccounts destroy a group of accounts +// DeleteAccounts destroys a group of accounts func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/deleteAccounts" diff --git a/pkg/cloudbroker/account/delete_user.go b/pkg/cloudbroker/account/delete_user.go index 4435130..6658591 100644 --- a/pkg/cloudbroker/account/delete_user.go +++ b/pkg/cloudbroker/account/delete_user.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to account +// DeleteUserRequest struct to revoke access to account type DeleteUserRequest struct { // ID of the account // Required: true @@ -20,16 +20,14 @@ type DeleteUserRequest struct { // Recursively revoke access rights from owned cloudspaces and vmachines // Required: false - RecursiveDelete bool `url:"recursivedelete" json:"recursivedelete" validate:"required"` + RecursiveDelete bool `url:"recursivedelete" json:"recursivedelete"` } // DeleteUser revokes user access from the account func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/deleteUser" diff --git a/pkg/cloudbroker/account/disable.go b/pkg/cloudbroker/account/disable.go index 2ff8499..65d496a 100644 --- a/pkg/cloudbroker/account/disable.go +++ b/pkg/cloudbroker/account/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable account +// DisableRequest struct to disable account type DisableRequest struct { // ID of account // Required: true @@ -23,9 +23,7 @@ type DisableRequest struct { func (a Account) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/disable" diff --git a/pkg/cloudbroker/account/disable_accounts.go b/pkg/cloudbroker/account/disable_accounts.go index 25e3923..a5ee191 100644 --- a/pkg/cloudbroker/account/disable_accounts.go +++ b/pkg/cloudbroker/account/disable_accounts.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable group accounts +// DisableAccountsRequest struct to disable group of accounts type DisableAccountsRequest struct { // IDs of accounts // Required: true @@ -18,9 +18,7 @@ type DisableAccountsRequest struct { func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/disableAccounts" diff --git a/pkg/cloudbroker/account/enable.go b/pkg/cloudbroker/account/enable.go index 1088ef6..c9c7e4d 100644 --- a/pkg/cloudbroker/account/enable.go +++ b/pkg/cloudbroker/account/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable account +// EnableRequest struct to enable account type EnableRequest struct { // ID of account // Required: true @@ -23,9 +23,7 @@ type EnableRequest struct { func (a Account) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/enable" diff --git a/pkg/cloudbroker/account/enable_accounts.go b/pkg/cloudbroker/account/enable_accounts.go index 365e7b2..685a68b 100644 --- a/pkg/cloudbroker/account/enable_accounts.go +++ b/pkg/cloudbroker/account/enable_accounts.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request for enable group accounts +// EnableAccountsRequest to enable group of accounts type EnableAccountsRequest struct { // IDs od accounts // Required: true @@ -18,9 +18,7 @@ type EnableAccountsRequest struct { func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/enableAccounts" diff --git a/pkg/cloudbroker/account/get.go b/pkg/cloudbroker/account/get.go index 9a74618..fe412f0 100644 --- a/pkg/cloudbroker/account/get.go +++ b/pkg/cloudbroker/account/get.go @@ -36,9 +36,7 @@ func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error func (a Account) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/get" diff --git a/pkg/cloudbroker/account/get_resource_consumption.go b/pkg/cloudbroker/account/get_resource_consumption.go index 3bdd624..fc0b268 100644 --- a/pkg/cloudbroker/account/get_resource_consumption.go +++ b/pkg/cloudbroker/account/get_resource_consumption.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting resource consumption +// GetResourceConsumptionRequest struct for getting resource consumption type GetResourceConsumptionRequest struct { // ID an account // Required: true AccountID uint64 `url:"accountId" json:"accountId" validate:"required"` } -// GetResourceConsumption show amount of consumed and reserved resources (cpu, ram, disk) by specific account +// GetResourceConsumption shows amount of consumed and reserved resources (cpu, ram, disk) by specific account func (a Account) GetResourceConsumption(ctx context.Context, req GetResourceConsumptionRequest) (*RecordResourceConsumption, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/getResourceConsumption" diff --git a/pkg/cloudbroker/account/list_computes.go b/pkg/cloudbroker/account/list_computes.go index f1ad745..fe9017c 100644 --- a/pkg/cloudbroker/account/list_computes.go +++ b/pkg/cloudbroker/account/list_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for a get list compute instances +// ListComputesRequest struct to a get list of compute instances type ListComputesRequest struct { // ID an account // Required: true @@ -55,13 +55,11 @@ type ListComputesRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListComputes gets list all compute instances under specified account, accessible by the user +// ListComputes gets list of all compute instances under specified account, accessible by the user func (a Account) ListComputes(ctx context.Context, req ListComputesRequest) (*ListComputes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/listComputes" diff --git a/pkg/cloudbroker/account/list_deleted.go b/pkg/cloudbroker/account/list_deleted.go index 25e3145..4d4cc42 100644 --- a/pkg/cloudbroker/account/list_deleted.go +++ b/pkg/cloudbroker/account/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted accounts +// ListDeletedRequest struct to get list of deleted accounts type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudbroker/account/list_disks.go b/pkg/cloudbroker/account/list_disks.go index d8db16a..cd6eea5 100644 --- a/pkg/cloudbroker/account/list_disks.go +++ b/pkg/cloudbroker/account/list_disks.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list deleted disks +// ListDisksRequest struct to get list of deleted disks type ListDisksRequest struct { // ID an account // Required: true @@ -39,13 +39,11 @@ type ListDisksRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListDisks gets list all currently unattached disks under specified account +// ListDisks gets list of all currently unattached disks under specified account func (a Account) ListDisks(ctx context.Context, req ListDisksRequest) (*ListDisks, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/listDisks" diff --git a/pkg/cloudbroker/account/list_flip_groups.go b/pkg/cloudbroker/account/list_flip_groups.go index 5952350..6a62d74 100644 --- a/pkg/cloudbroker/account/list_flip_groups.go +++ b/pkg/cloudbroker/account/list_flip_groups.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list FLIPGroups +// ListFLIPGroupsRequest struct to get list of FLIPGroups type ListFLIPGroupsRequest struct { // ID an account // Required: true @@ -47,13 +47,11 @@ type ListFLIPGroupsRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListFLIPGroups gets list all FLIPGroups under specified account, accessible by the user +// ListFLIPGroups gets list of all FLIPGroups under specified account, accessible by the user func (a Account) ListFLIPGroups(ctx context.Context, req ListFLIPGroupsRequest) (*ListFLIPGroups, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/listFlipGroups" diff --git a/pkg/cloudbroker/account/list_rg.go b/pkg/cloudbroker/account/list_rg.go index d3f7d57..75da776 100644 --- a/pkg/cloudbroker/account/list_rg.go +++ b/pkg/cloudbroker/account/list_rg.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list resource groups +// ListRGRequest struct to get list of resource groups type ListRGRequest struct { // ID an account // Required: true @@ -43,13 +43,11 @@ type ListRGRequest struct { Status string `url:"status,omitempty" json:"status,omitempty"` } -// ListRG gets list all resource groups under specified account, accessible by the user +// ListRG gets list of all resource groups under specified account, accessible by the user func (a Account) ListRG(ctx context.Context, req ListRGRequest) (*ListRG, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/listRG" diff --git a/pkg/cloudbroker/account/list_vins.go b/pkg/cloudbroker/account/list_vins.go index aa9abd2..9270bfd 100644 --- a/pkg/cloudbroker/account/list_vins.go +++ b/pkg/cloudbroker/account/list_vins.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list VINS +// ListVINSRequest struct to get list of VINS type ListVINSRequest struct { // ID an account // Required: true @@ -39,13 +39,11 @@ type ListVINSRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListVINS gets list all ViNSes under specified account, accessible by the user +// ListVINS gets list of all ViNSes under specified account, accessible by the user func (a Account) ListVINS(ctx context.Context, req ListVINSRequest) (*ListVINS, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/listVins" diff --git a/pkg/cloudbroker/account/restore.go b/pkg/cloudbroker/account/restore.go index edf2d5a..4e7e35d 100644 --- a/pkg/cloudbroker/account/restore.go +++ b/pkg/cloudbroker/account/restore.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore a deleted account +// RestoreRequest struct to restore a deleted account type RestoreRequest struct { // ID an account // Required: true @@ -22,9 +22,7 @@ type RestoreRequest struct { func (a Account) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/restore" diff --git a/pkg/cloudbroker/account/set_cpu_allocation_parameter.go b/pkg/cloudbroker/account/set_cpu_allocation_parameter.go index 04c28db..8409c25 100644 --- a/pkg/cloudbroker/account/set_cpu_allocation_parameter.go +++ b/pkg/cloudbroker/account/set_cpu_allocation_parameter.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for setting CPU allocation parameter +// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter type SetCPUAllocationParameterRequest struct { // Account ID // Required: true @@ -24,9 +24,7 @@ type SetCPUAllocationParameterRequest struct { func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/setCpuAllocationParameter" diff --git a/pkg/cloudbroker/account/set_cpu_allocation_ratio.go b/pkg/cloudbroker/account/set_cpu_allocation_ratio.go index d76156b..f620337 100644 --- a/pkg/cloudbroker/account/set_cpu_allocation_ratio.go +++ b/pkg/cloudbroker/account/set_cpu_allocation_ratio.go @@ -7,24 +7,23 @@ import ( "strconv" ) -// Request for setting CPU allocation ratio +// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio type SetCPUAllocationRatioRequest struct { // Account ID // Required: true AccountID uint64 `url:"accountId" json:"accoutnId" validate:"required"` // CPU allocation ratio, i.e. one pCPU = ratio*vCPU - // Required: true - Ratio float64 `url:"ratio" json:"ratio" validate:"required"` + // if don't set, default value = 0 + // Required: false + Ratio float64 `url:"ratio" json:"ratio"` } // SetCPUAllocationRatio sets CPU allocation ratio func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/setCpuAllocationRatio" diff --git a/pkg/cloudbroker/account/update.go b/pkg/cloudbroker/account/update.go index 12e00ff..d1c2060 100644 --- a/pkg/cloudbroker/account/update.go +++ b/pkg/cloudbroker/account/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update account +// UpdateRequest struct to update account type UpdateRequest struct { // ID of account // Required: true @@ -56,9 +56,7 @@ type UpdateRequest struct { func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/update" diff --git a/pkg/cloudbroker/account/update_resource_types.go b/pkg/cloudbroker/account/update_resource_types.go index ad3ac7d..6a5a195 100644 --- a/pkg/cloudbroker/account/update_resource_types.go +++ b/pkg/cloudbroker/account/update_resource_types.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update resource types in account +// UpdateResourceTypesRequest struct to update resource types in account type UpdateResourceTypesRequest struct { // ID of account // Required: true @@ -29,9 +29,7 @@ type UpdateResourceTypesRequest struct { func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceTypesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/updateResourceTypes" diff --git a/pkg/cloudbroker/account/update_user.go b/pkg/cloudbroker/account/update_user.go index 604e30b..0626145 100644 --- a/pkg/cloudbroker/account/update_user.go +++ b/pkg/cloudbroker/account/update_user.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update user access rights +// UpdateUserRequest struct to update user access rights type UpdateUserRequest struct { // ID of the account // Required: true @@ -30,9 +30,7 @@ type UpdateUserRequest struct { func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/account/updateUser" diff --git a/pkg/cloudbroker/apiaccess/api_find.go b/pkg/cloudbroker/apiaccess/api_find.go index c794a5c..e79ed90 100644 --- a/pkg/cloudbroker/apiaccess/api_find.go +++ b/pkg/cloudbroker/apiaccess/api_find.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for finding apiaccess groups. +// APIFindRequest struct for finding apiaccess groups. type APIFindRequest struct { // API function to find // Example: cloudbroker/k8s/create @@ -20,9 +20,7 @@ type APIFindRequest struct { func (a APIAccess) APIFind(ctx context.Context, req APIFindRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/apiFind" diff --git a/pkg/cloudbroker/apiaccess/apis_exclude.go b/pkg/cloudbroker/apiaccess/apis_exclude.go index f973d8b..ac141ee 100644 --- a/pkg/cloudbroker/apiaccess/apis_exclude.go +++ b/pkg/cloudbroker/apiaccess/apis_exclude.go @@ -9,7 +9,9 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for removing api from access group. +type APIString string + +// APIsExcludeRequest struct for removing api from access group. type APIsExcludeRequest struct { // APIAccess group ID // Required: true @@ -17,7 +19,7 @@ type APIsExcludeRequest struct { // APIs to remove from APIAccess group // Required: true - APIs APIsEndpoints `url:"-" json:"-" validate:"required"` + APIs APIString `url:"-" json:"apis" validate:"required"` } type wrapperAPIsExcludeRequest struct { @@ -30,9 +32,7 @@ type wrapperAPIsExcludeRequest struct { func (a APIAccess) APIsExclude(ctx context.Context, req APIsExcludeRequest) (*APIsEndpoints, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/apisExclude" diff --git a/pkg/cloudbroker/apiaccess/apis_include.go b/pkg/cloudbroker/apiaccess/apis_include.go index 94cad32..0f0af02 100644 --- a/pkg/cloudbroker/apiaccess/apis_include.go +++ b/pkg/cloudbroker/apiaccess/apis_include.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for adding api to access group. +// APIsIncludeRequest struct for adding api to access group. type APIsIncludeRequest struct { // APIAccess group ID. // Required: true @@ -16,7 +16,7 @@ type APIsIncludeRequest struct { // APIs to add to APIAccess group. // Required: true - APIs APIsEndpoints `url:"-" json:"-" validate:"required"` + APIs APIString `url:"-" json:"apis" validate:"required"` } type wrapperAPIsIncludeRequest struct { @@ -29,9 +29,7 @@ type wrapperAPIsIncludeRequest struct { func (a APIAccess) APIsInclude(ctx context.Context, req APIsIncludeRequest) (*APIsEndpoints, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/apisInclude" diff --git a/pkg/cloudbroker/apiaccess/copy.go b/pkg/cloudbroker/apiaccess/copy.go index dfd44d2..551fefc 100644 --- a/pkg/cloudbroker/apiaccess/copy.go +++ b/pkg/cloudbroker/apiaccess/copy.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for copying apiaccess group. +// CopyRequest Request for copying apiaccess group. type CopyRequest struct { // ID of the API access group to make copy from // Required: true @@ -23,9 +23,7 @@ type CopyRequest struct { func (a APIAccess) Copy(ctx context.Context, req CopyRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/copy" diff --git a/pkg/cloudbroker/apiaccess/create.go b/pkg/cloudbroker/apiaccess/create.go index e8f9c2a..54e0087 100644 --- a/pkg/cloudbroker/apiaccess/create.go +++ b/pkg/cloudbroker/apiaccess/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for creating apiaccess group. +// CreateRequest struct for creating apiaccess group. type CreateRequest struct { // Name of this apiaccess group. // Required: true @@ -23,9 +23,7 @@ type CreateRequest struct { func (a APIAccess) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/create" diff --git a/pkg/cloudbroker/apiaccess/delete.go b/pkg/cloudbroker/apiaccess/delete.go index cbdcc8b..2ee4d14 100644 --- a/pkg/cloudbroker/apiaccess/delete.go +++ b/pkg/cloudbroker/apiaccess/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for deleting apiaccess group. +// DeleteRequest struct for deleting apiaccess group. type DeleteRequest struct { // APIAccess group ID. // Required: true @@ -23,9 +23,7 @@ type DeleteRequest struct { func (a APIAccess) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/delete" diff --git a/pkg/cloudbroker/apiaccess/desc_update.go b/pkg/cloudbroker/apiaccess/desc_update.go index c2ce70f..081056f 100644 --- a/pkg/cloudbroker/apiaccess/desc_update.go +++ b/pkg/cloudbroker/apiaccess/desc_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for updating apiaccess group description. +// DescUpdateRequest struct for updating apiaccess group description. type DescUpdateRequest struct { // APIAccess group ID. // Required: true @@ -23,9 +23,7 @@ type DescUpdateRequest struct { func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/descUpdate" diff --git a/pkg/cloudbroker/apiaccess/get.go b/pkg/cloudbroker/apiaccess/get.go index cf5c48c..b225673 100644 --- a/pkg/cloudbroker/apiaccess/get.go +++ b/pkg/cloudbroker/apiaccess/get.go @@ -36,9 +36,7 @@ func (a APIAccess) Get(ctx context.Context, req GetRequest) (*ItemAPIAccess, err func (a APIAccess) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/get" diff --git a/pkg/cloudbroker/apiaccess/list.go b/pkg/cloudbroker/apiaccess/list.go index 1128d12..c4d7550 100644 --- a/pkg/cloudbroker/apiaccess/list.go +++ b/pkg/cloudbroker/apiaccess/list.go @@ -4,8 +4,6 @@ import ( "context" "encoding/json" "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // ListRequest struct to get list of all non deleted apiaccess instances. @@ -62,13 +60,6 @@ func (a APIAccess) List(ctx context.Context, req ListRequest) (*ListAPIAccess, e // ListRaw gets list of all non deleted apiaccess instances as an array of bytes func (a APIAccess) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) { - err := validators.ValidateRequest(req) - if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } - } - url := "/cloudbroker/apiaccess/list" res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req) diff --git a/pkg/cloudbroker/apiaccess/list_deleted.go b/pkg/cloudbroker/apiaccess/list_deleted.go index 607e6f2..08e2522 100644 --- a/pkg/cloudbroker/apiaccess/list_deleted.go +++ b/pkg/cloudbroker/apiaccess/list_deleted.go @@ -4,11 +4,9 @@ import ( "context" "encoding/json" "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting list of all deleted apiaccess instances. +// ListDeletedRequest struct for getting list of all deleted apiaccess instances. type ListDeletedRequest struct { // Page number. // Required: false @@ -21,13 +19,6 @@ type ListDeletedRequest struct { // ListDeleted gets list of all deleted apiaccess instances. func (a APIAccess) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListAPIAccess, error) { - err := validators.ValidateRequest(req) - if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } - } - url := "/cloudbroker/apiaccess/listDeleted" info := ListAPIAccess{} diff --git a/pkg/cloudbroker/apiaccess/set_default.go b/pkg/cloudbroker/apiaccess/set_default.go index ca3ee22..7f3f2ab 100644 --- a/pkg/cloudbroker/apiaccess/set_default.go +++ b/pkg/cloudbroker/apiaccess/set_default.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Reqeust struct for setting default apiaccess group. +// SetDefaultRequest struct for setting default apiaccess group. type SetDefaultRequest struct { // APIAccess group ID // Required: true @@ -19,9 +19,7 @@ type SetDefaultRequest struct { func (a APIAccess) SetDefault(ctx context.Context, req SetDefaultRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/setDefault" diff --git a/pkg/cloudbroker/apiaccess/subtract.go b/pkg/cloudbroker/apiaccess/subtract.go index 4820b1e..02780d2 100644 --- a/pkg/cloudbroker/apiaccess/subtract.go +++ b/pkg/cloudbroker/apiaccess/subtract.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for subtracting. +// SubtractRequest struct for subtracting. type SubtractRequest struct { // ID of the API access group to subtract from. This group will contain the difference. MinuendID uint64 `url:"minuendId" json:"minuendId" validate:"required"` @@ -22,9 +22,7 @@ type SubtractRequest struct { func (a APIAccess) Subtruct(ctx context.Context, req SubtractRequest) (*APIsEndpoints, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/subtract" diff --git a/pkg/cloudbroker/apiaccess/union.go b/pkg/cloudbroker/apiaccess/union.go index fb55c88..e97160e 100644 --- a/pkg/cloudbroker/apiaccess/union.go +++ b/pkg/cloudbroker/apiaccess/union.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for union. +// UnionRequest struct for union. type UnionRequest struct { // Recipient apiaccess group ID // Required: true @@ -19,14 +19,12 @@ type UnionRequest struct { DonorID uint64 `url:"donorId" json:"donorId" validate:"required"` } -// Combines the API list of group #1 ("recipient") and group #2 ("donor"), +// Union combines the API list of group #1 ("recipient") and group #2 ("donor"), // writing the result to group #1 and avoiding duplicates in the list func (a APIAccess) Union(ctx context.Context, req UnionRequest) (*APIsEndpoints, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/union" diff --git a/pkg/cloudbroker/apiaccess/update.go b/pkg/cloudbroker/apiaccess/update.go index d4397f0..533d9fa 100644 --- a/pkg/cloudbroker/apiaccess/update.go +++ b/pkg/cloudbroker/apiaccess/update.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for updating apis of apiaccess group. +// UpdateRequest struct for updating apis of apiaccess group. type UpdateRequest struct { // APIAccess group ID // Required: true @@ -30,9 +30,7 @@ type wrapperUpdateRequest struct { func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/update" diff --git a/pkg/cloudbroker/apiaccess/user_list.go b/pkg/cloudbroker/apiaccess/user_list.go index 8cac94b..b5fe3e2 100644 --- a/pkg/cloudbroker/apiaccess/user_list.go +++ b/pkg/cloudbroker/apiaccess/user_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting a list of users currently included in the specified group. +// UserListRequest struct for getting a list of users currently included in the specified group. type UserListRequest struct { // APIAccess group ID // Required: true @@ -19,9 +19,7 @@ type UserListRequest struct { func (a APIAccess) UserList(ctx context.Context, req UserListRequest) ([]string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/apiaccess/userList" diff --git a/pkg/cloudbroker/backup/create_disk_backup.go b/pkg/cloudbroker/backup/create_disk_backup.go index e483848..f85a493 100644 --- a/pkg/cloudbroker/backup/create_disk_backup.go +++ b/pkg/cloudbroker/backup/create_disk_backup.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for creating disk backup +// CreateDiskBackupRequest struct for creating disk backup type CreateDiskBackupRequest struct { // Compute ID // Required: true @@ -34,9 +34,7 @@ type wrapperCreateDiskBackupRequest struct { func (b Backup) CreateDiskBackup(ctx context.Context, req CreateDiskBackupRequest) (ListInfoBackup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateDiskBackupRequest{ @@ -65,9 +63,7 @@ func (b Backup) CreateDiskBackup(ctx context.Context, req CreateDiskBackupReques func (b Backup) CreateDiskBackupAsync(ctx context.Context, req CreateDiskBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateDiskBackupRequest{ diff --git a/pkg/cloudbroker/backup/create_disks_backup.go b/pkg/cloudbroker/backup/create_disks_backup.go index 801ae90..85cae35 100644 --- a/pkg/cloudbroker/backup/create_disks_backup.go +++ b/pkg/cloudbroker/backup/create_disks_backup.go @@ -17,7 +17,7 @@ type Disk struct { BackupPath string `url:"backupPath" json:"backupPath" validate:"required"` } -// Request struct for creating disks backup +// CreateDisksBackupRequest struct for creating disks backup type CreateDisksBackupRequest struct { // Compute ID ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` @@ -36,9 +36,7 @@ type wrapperCreateDisksBackupRequest struct { func (b Backup) CreateDisksBackup(ctx context.Context, req CreateDisksBackupRequest) (ListInfoBackup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateDisksBackupRequest{ @@ -67,9 +65,7 @@ func (b Backup) CreateDisksBackup(ctx context.Context, req CreateDisksBackupRequ func (b Backup) CreateDisksBackupAsync(ctx context.Context, req CreateDisksBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateDisksBackupRequest{ diff --git a/pkg/cloudbroker/backup/delete_disk_backup.go b/pkg/cloudbroker/backup/delete_disk_backup.go index 366004d..33f16f9 100644 --- a/pkg/cloudbroker/backup/delete_disk_backup.go +++ b/pkg/cloudbroker/backup/delete_disk_backup.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for deleting disk backup +// DeleteDiskBackupRequest struct for deleting disk backup type DeleteDiskBackupRequest struct { // Backup path BackupPath string `url:"backupPath" json:"backupPath" validate:"required"` @@ -28,9 +28,7 @@ type wrapperDeleteDiskBackupRequest struct { func (b Backup) DeleteDiskBackup(ctx context.Context, req DeleteDiskBackupRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperDeleteDiskBackupRequest{ @@ -57,9 +55,7 @@ func (b Backup) DeleteDiskBackup(ctx context.Context, req DeleteDiskBackupReques func (b Backup) DeleteDiskBackupAsync(ctx context.Context, req DeleteDiskBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperDeleteDiskBackupRequest{ diff --git a/pkg/cloudbroker/backup/list_backup_paths.go b/pkg/cloudbroker/backup/list_backup_paths.go index 78c49d6..66bf748 100644 --- a/pkg/cloudbroker/backup/list_backup_paths.go +++ b/pkg/cloudbroker/backup/list_backup_paths.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting list of backup paths +// ListBackupPathsRequest struct for getting list of backup paths type ListBackupPathsRequest struct { // Grid ID GID uint64 `url:"gridId" json:"gridId" validate:"required"` @@ -17,9 +17,7 @@ type ListBackupPathsRequest struct { func (b Backup) ListBackupPaths(ctx context.Context, req ListBackupPathsRequest) ([]string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/backup/listBackupPaths" diff --git a/pkg/cloudbroker/backup/restore_disk_from_backup.go b/pkg/cloudbroker/backup/restore_disk_from_backup.go index 25e6854..97c451c 100644 --- a/pkg/cloudbroker/backup/restore_disk_from_backup.go +++ b/pkg/cloudbroker/backup/restore_disk_from_backup.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restoring disk from backup +// RestoreDiskFromBackupRequest struct for restoring disk from backup type RestoreDiskFromBackupRequest struct { // Compute ID ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` @@ -34,9 +34,7 @@ type wrapperRestoreDiskFromBackupRequest struct { func (b Backup) RestoreDiskFromBackup(ctx context.Context, req RestoreDiskFromBackupRequest) (ListInfoRestoredDisk, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperRestoreDiskFromBackupRequest{ @@ -65,9 +63,7 @@ func (b Backup) RestoreDiskFromBackup(ctx context.Context, req RestoreDiskFromBa func (b Backup) RestoreDiskFromBackupAsync(ctx context.Context, req RestoreDiskFromBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperRestoreDiskFromBackupRequest{ diff --git a/pkg/cloudbroker/backup/restore_disks_from_backup.go b/pkg/cloudbroker/backup/restore_disks_from_backup.go index 3b32528..24799e6 100644 --- a/pkg/cloudbroker/backup/restore_disks_from_backup.go +++ b/pkg/cloudbroker/backup/restore_disks_from_backup.go @@ -20,7 +20,7 @@ type BackupFile struct { BackupFile string `url:"backupFile" json:"backupFile" validate:"required"` } -// Request struct for restoring disks from backup +// RestoreDisksFromBackupRequest struct for restoring disks from backup type RestoreDisksFromBackupRequest struct { // Compute ID ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` @@ -39,9 +39,7 @@ type wrapperRestoreDisksFromBackupRequest struct { func (b Backup) RestoreDisksFromBackup(ctx context.Context, req RestoreDisksFromBackupRequest) (ListInfoRestoredDisk, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperRestoreDisksFromBackupRequest{ @@ -70,9 +68,7 @@ func (b Backup) RestoreDisksFromBackup(ctx context.Context, req RestoreDisksFrom func (b Backup) RestoreDisksFromBackupAsync(ctx context.Context, req RestoreDisksFromBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperRestoreDisksFromBackupRequest{ diff --git a/pkg/cloudbroker/compute/affinity_group_check_start.go b/pkg/cloudbroker/compute/affinity_group_check_start.go index 4d39a8f..6deebe3 100644 --- a/pkg/cloudbroker/compute/affinity_group_check_start.go +++ b/pkg/cloudbroker/compute/affinity_group_check_start.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for check all computes with current affinity label can start +// AffinityGroupCheckStartRequest struct to check all computes with current affinity label can start type AffinityGroupCheckStartRequest struct { // ID of the resource group // Required: true @@ -22,9 +22,7 @@ type AffinityGroupCheckStartRequest struct { func (c Compute) AffinityGroupCheckStart(ctx context.Context, req AffinityGroupCheckStartRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityGroupCheckStart" diff --git a/pkg/cloudbroker/compute/affinity_label_remove.go b/pkg/cloudbroker/compute/affinity_label_remove.go index a8b103f..7290a7e 100644 --- a/pkg/cloudbroker/compute/affinity_label_remove.go +++ b/pkg/cloudbroker/compute/affinity_label_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clear affinity label for compute +// AffinityLabelRemoveRequest struct for clear affinity label for compute type AffinityLabelRemoveRequest struct { // IDs of the compute instances // Required: true @@ -19,9 +19,7 @@ type AffinityLabelRemoveRequest struct { func (c Compute) AffinityLabelRemove(ctx context.Context, req AffinityLabelRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityLabelRemove" diff --git a/pkg/cloudbroker/compute/affinity_label_set.go b/pkg/cloudbroker/compute/affinity_label_set.go index 2e7ef14..00835b6 100644 --- a/pkg/cloudbroker/compute/affinity_label_set.go +++ b/pkg/cloudbroker/compute/affinity_label_set.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set affinity label for compute +// AffinityLabelSetRequest struct to set affinity label for compute type AffinityLabelSetRequest struct { // IDs of the compute instances ComputeIDs []uint64 `url:"computeIds" json:"computeIds" validate:"min=1"` @@ -18,13 +18,11 @@ type AffinityLabelSetRequest struct { AffinityLabel string `url:"affinityLabel" json:"affinityLabel" validate:"required"` } -// AffinityLabelSet set affinity label for compute +// AffinityLabelSet sets affinity label for compute func (c Compute) AffinityLabelSet(ctx context.Context, req AffinityLabelSetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityLabelSet" diff --git a/pkg/cloudbroker/compute/affinity_relations.go b/pkg/cloudbroker/compute/affinity_relations.go index 65fad42..16ef53c 100644 --- a/pkg/cloudbroker/compute/affinity_relations.go +++ b/pkg/cloudbroker/compute/affinity_relations.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get dict of computes +// AffinityRelationsRequest struct to get dict of computes type AffinityRelationsRequest struct { // ID of the compute instance // Required: true @@ -23,9 +23,7 @@ type AffinityRelationsRequest struct { func (c Compute) AffinityRelations(ctx context.Context, req AffinityRelationsRequest) (*RecordAffinityRelations, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityRelations" diff --git a/pkg/cloudbroker/compute/affinity_rule_add.go b/pkg/cloudbroker/compute/affinity_rule_add.go index 5aba630..0addc87 100644 --- a/pkg/cloudbroker/compute/affinity_rule_add.go +++ b/pkg/cloudbroker/compute/affinity_rule_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add affinity rule +// AffinityRuleAddRequest struct to add affinity rule type AffinityRuleAddRequest struct { // IDs of the compute instances // Required: true @@ -44,13 +44,11 @@ type AffinityRuleAddRequest struct { Value string `url:"value" json:"value" validate:"required"` } -// AffinityRuleAdd add affinity rule +// AffinityRuleAdd adds affinity rule func (c Compute) AffinityRuleAdd(ctx context.Context, req AffinityRuleAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityRuleAdd" diff --git a/pkg/cloudbroker/compute/affinity_rule_remove.go b/pkg/cloudbroker/compute/affinity_rule_remove.go index 3ed85f6..5d136db 100644 --- a/pkg/cloudbroker/compute/affinity_rule_remove.go +++ b/pkg/cloudbroker/compute/affinity_rule_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove affinity rule +// AffinityRuleRemoveRequest struct to remove affinity rule type AffinityRuleRemoveRequest struct { // IDs of the compute instances // Required: true @@ -46,9 +46,7 @@ type AffinityRuleRemoveRequest struct { func (c Compute) AffinityRuleRemove(ctx context.Context, req AffinityRuleRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityRuleRemove" diff --git a/pkg/cloudbroker/compute/affinity_rules_clear.go b/pkg/cloudbroker/compute/affinity_rules_clear.go index 31c1e5b..65ade2d 100644 --- a/pkg/cloudbroker/compute/affinity_rules_clear.go +++ b/pkg/cloudbroker/compute/affinity_rules_clear.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clear affinity rules +// AffinityRulesClearRequest struct to clear affinity rules type AffinityRulesClearRequest struct { // IDs of the compute instances // Required: true ComputeIDs []uint64 `url:"computeIds" json:"computeIds" validate:"min=1"` } -// AffinityRulesClear clear affinity rules +// AffinityRulesClear clears affinity rules func (c Compute) AffinityRulesClear(ctx context.Context, req AffinityRulesClearRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/affinityRulesClear" diff --git a/pkg/cloudbroker/compute/anti_affinity_rule_add.go b/pkg/cloudbroker/compute/anti_affinity_rule_add.go index 8dfa919..d9007b7 100644 --- a/pkg/cloudbroker/compute/anti_affinity_rule_add.go +++ b/pkg/cloudbroker/compute/anti_affinity_rule_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add anti affinity rule +// AntiAffinityRuleAddRequest struct to add anti affinity rule type AntiAffinityRuleAddRequest struct { // IDs of the compute instances // Required: true @@ -42,13 +42,11 @@ type AntiAffinityRuleAddRequest struct { Value string `url:"value" json:"value" validate:"required"` } -// AntiAffinityRuleAdd add anti affinity rule +// AntiAffinityRuleAdd adds anti affinity rule func (c Compute) AntiAffinityRuleAdd(ctx context.Context, req AntiAffinityRuleAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/antiAffinityRuleAdd" diff --git a/pkg/cloudbroker/compute/anti_affinity_rule_clear.go b/pkg/cloudbroker/compute/anti_affinity_rule_clear.go index 387289a..837a168 100644 --- a/pkg/cloudbroker/compute/anti_affinity_rule_clear.go +++ b/pkg/cloudbroker/compute/anti_affinity_rule_clear.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clear anti affinity rules +// AntiAffinityRulesClearRequest struct to clear anti affinity rules type AntiAffinityRulesClearRequest struct { // IDs of the compute instances // Required: true @@ -19,9 +19,7 @@ type AntiAffinityRulesClearRequest struct { func (c Compute) AntiAffinityRulesClear(ctx context.Context, req AntiAffinityRulesClearRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/antiAffinityRulesClear" diff --git a/pkg/cloudbroker/compute/anti_affinity_rule_remove.go b/pkg/cloudbroker/compute/anti_affinity_rule_remove.go index 037f148..c4decb0 100644 --- a/pkg/cloudbroker/compute/anti_affinity_rule_remove.go +++ b/pkg/cloudbroker/compute/anti_affinity_rule_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove anti affinity rule +// AntiAffinityRuleRemoveRequest struct to remove anti affinity rule type AntiAffinityRuleRemoveRequest struct { // IDs of the compute instances // Required: true @@ -42,13 +42,11 @@ type AntiAffinityRuleRemoveRequest struct { Value string `url:"value" json:"value" validate:"required"` } -// AntiAffinityRuleRemove remove anti affinity rule +// AntiAffinityRuleRemove removes anti affinity rule func (c Compute) AntiAffinityRuleRemove(ctx context.Context, req AntiAffinityRuleRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/antiAffinityRuleRemove" diff --git a/pkg/cloudbroker/compute/attach_gpu.go b/pkg/cloudbroker/compute/attach_gpu.go index 254f939..d5a3cd6 100644 --- a/pkg/cloudbroker/compute/attach_gpu.go +++ b/pkg/cloudbroker/compute/attach_gpu.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for attach GPU for compute +// AttachGPURequest struct to attach GPU for compute type AttachGPURequest struct { // Identifier compute // Required: true @@ -19,13 +19,11 @@ type AttachGPURequest struct { VGPUID uint64 `url:"vgpuId" json:"vgpuId" validate:"required"` } -// AttachGPU attach GPU for compute, returns vGPU ID on success +// AttachGPU attaches GPU for compute, returns vGPU ID on success func (c Compute) AttachGPU(ctx context.Context, req AttachGPURequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/attachGpu" diff --git a/pkg/cloudbroker/compute/attach_pci_device.go b/pkg/cloudbroker/compute/attach_pci_device.go index fb3be21..db4cd6a 100644 --- a/pkg/cloudbroker/compute/attach_pci_device.go +++ b/pkg/cloudbroker/compute/attach_pci_device.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for atttach PCI device +// AttachPCIDeviceRequest struct to attach PCI device type AttachPCIDeviceRequest struct { // Identifier compute // Required: true @@ -19,13 +19,11 @@ type AttachPCIDeviceRequest struct { DeviceID uint64 `url:"deviceId" json:"deviceId" validate:"required"` } -// AttachPCIDevice attach PCI device +// AttachPCIDevice attaches PCI device func (c Compute) AttachPCIDevice(ctx context.Context, req AttachPCIDeviceRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/attachPciDevice" diff --git a/pkg/cloudbroker/compute/audits.go b/pkg/cloudbroker/compute/audits.go index 7edd52d..23943e6 100644 --- a/pkg/cloudbroker/compute/audits.go +++ b/pkg/cloudbroker/compute/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get audit records +// AuditsRequest struct to get audit records type AuditsRequest struct { // ID of the compute // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (c Compute) Audits(ctx context.Context, req AuditsRequest) (ListDetailedAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/audits" diff --git a/pkg/cloudbroker/compute/boot_order_get.go b/pkg/cloudbroker/compute/boot_order_get.go index b76a77e..6dbccd1 100644 --- a/pkg/cloudbroker/compute/boot_order_get.go +++ b/pkg/cloudbroker/compute/boot_order_get.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get boot order +// BootOrderGetRequest struct to get boot order type BootOrderGetRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type BootOrderGetRequest struct { func (c Compute) BootOrderGet(ctx context.Context, req BootOrderGetRequest) ([]string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/bootOrderGet" diff --git a/pkg/cloudbroker/compute/boot_order_set.go b/pkg/cloudbroker/compute/boot_order_set.go index 71edfe1..b5468c5 100644 --- a/pkg/cloudbroker/compute/boot_order_set.go +++ b/pkg/cloudbroker/compute/boot_order_set.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set boot order +// BootOrderSetRequest struct to set boot order type BootOrderSetRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type BootOrderSetRequest struct { func (c Compute) BootOrderSet(ctx context.Context, req BootOrderSetRequest) ([]string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/bootOrderSet" diff --git a/pkg/cloudbroker/compute/cd_eject.go b/pkg/cloudbroker/compute/cd_eject.go index 5dfdfa2..f04c473 100644 --- a/pkg/cloudbroker/compute/cd_eject.go +++ b/pkg/cloudbroker/compute/cd_eject.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for eject CD image +// CDEjectRequest struct to eject CD image type CDEjectRequest struct { // ID of compute instance // Required: true @@ -19,13 +19,11 @@ type CDEjectRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// CDEject eject CD image to compute's CD-ROM +// CDEject ejects CD image to compute's CD-ROM func (c Compute) CDEject(ctx context.Context, req CDEjectRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/cdEject" diff --git a/pkg/cloudbroker/compute/cd_insert.go b/pkg/cloudbroker/compute/cd_insert.go index 415937d..4515d33 100644 --- a/pkg/cloudbroker/compute/cd_insert.go +++ b/pkg/cloudbroker/compute/cd_insert.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for insert new CD image +// CDInsertRequest struct to insert new CD image type CDInsertRequest struct { // ID of compute instance // Required: true @@ -22,13 +22,11 @@ type CDInsertRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// CDInsert insert new CD image to compute's CD-ROM +// CDInsert inserts new CD image to compute's CD-ROM func (c Compute) CDInsert(ctx context.Context, req CDInsertRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/cdInsert" diff --git a/pkg/cloudbroker/compute/change_link_state.go b/pkg/cloudbroker/compute/change_link_state.go index 9817765..5082709 100644 --- a/pkg/cloudbroker/compute/change_link_state.go +++ b/pkg/cloudbroker/compute/change_link_state.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request struct for changing link state +// ChangeLinkStateRequest struct for changing link state type ChangeLinkStateRequest struct { // Compute ID // Required: true @@ -27,9 +27,7 @@ type ChangeLinkStateRequest struct { func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/changeLinkState" diff --git a/pkg/cloudbroker/compute/clone.go b/pkg/cloudbroker/compute/clone.go index b814ebe..8b17a2a 100644 --- a/pkg/cloudbroker/compute/clone.go +++ b/pkg/cloudbroker/compute/clone.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for clone compute instance +// CloneRequest struct to clone compute instance type CloneRequest struct { // ID of compute instance // Required: true @@ -35,9 +35,7 @@ type CloneRequest struct { func (c Compute) Clone(ctx context.Context, req CloneRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/clone" diff --git a/pkg/cloudbroker/compute/computeci_set.go b/pkg/cloudbroker/compute/computeci_set.go index 202de4d..515812a 100644 --- a/pkg/cloudbroker/compute/computeci_set.go +++ b/pkg/cloudbroker/compute/computeci_set.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set compute CI +// ComputeCISetRequest struct to set compute CI type ComputeCISetRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type ComputeCISetRequest struct { func (c Compute) ComputeCISet(ctx context.Context, req ComputeCISetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/computeciSet" diff --git a/pkg/cloudbroker/compute/computeci_unset.go b/pkg/cloudbroker/compute/computeci_unset.go index 4691ad5..8696e0d 100644 --- a/pkg/cloudbroker/compute/computeci_unset.go +++ b/pkg/cloudbroker/compute/computeci_unset.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for unset compite CI +// ComputeCIUnsetRequest struct to unset compute CI type ComputeCIUnsetRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type ComputeCIUnsetRequest struct { func (c Compute) ComputeCIUnset(ctx context.Context, req ComputeCIUnsetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/computeciUnset" diff --git a/pkg/cloudbroker/compute/create_template.go b/pkg/cloudbroker/compute/create_template.go index f292e68..e649fca 100644 --- a/pkg/cloudbroker/compute/create_template.go +++ b/pkg/cloudbroker/compute/create_template.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create template +// CreateTemplateRequest struct to create template type CreateTemplateRequest struct { // ID of the compute to create template from // Required: true @@ -34,9 +34,7 @@ type wrapperCreateTemplateRequest struct { func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateTemplateRequest{ @@ -60,9 +58,7 @@ func (c Compute) CreateTemplateAsync(ctx context.Context, req CreateTemplateRequ func (c Compute) CreateTemplate(ctx context.Context, req CreateTemplateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } reqWrapped := wrapperCreateTemplateRequest{ diff --git a/pkg/cloudbroker/compute/delete.go b/pkg/cloudbroker/compute/delete.go index 35ea390..dd5349a 100644 --- a/pkg/cloudbroker/compute/delete.go +++ b/pkg/cloudbroker/compute/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete compute +// DeleteRequest struct to delete compute type DeleteRequest struct { // ID of compute instance // Required: true @@ -31,9 +31,7 @@ type DeleteRequest struct { func (c Compute) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/delete" diff --git a/pkg/cloudbroker/compute/detach_gpu.go b/pkg/cloudbroker/compute/detach_gpu.go index b285284..a91209f 100644 --- a/pkg/cloudbroker/compute/detach_gpu.go +++ b/pkg/cloudbroker/compute/detach_gpu.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach VGPU for compute +// DetachGPURequest struct to detach VGPU for compute type DetachGPURequest struct { // Identifier compute // Required: true @@ -19,14 +19,12 @@ type DetachGPURequest struct { VGPUID int64 `url:"vgpuId,omitempty" json:"vgpuId,omitempty"` } -// DetachGPU detach VGPU for compute. +// DetachGPU detaches VGPU for compute. // If param VGPU ID is equivalent -1, then detach all VGPU for compute func (c Compute) DetachGPU(ctx context.Context, req DetachGPURequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/detachGpu" diff --git a/pkg/cloudbroker/compute/detach_pci_device.go b/pkg/cloudbroker/compute/detach_pci_device.go index 30f053b..0df9740 100644 --- a/pkg/cloudbroker/compute/detach_pci_device.go +++ b/pkg/cloudbroker/compute/detach_pci_device.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach PCI device +// DetachPCIDeviceRequest struct to detach PCI device type DetachPCIDeviceRequest struct { // Identifier compute // Required: true @@ -19,13 +19,11 @@ type DetachPCIDeviceRequest struct { DeviceID uint64 `url:"deviceId" json:"deviceId" validate:"required"` } -// DetachPCIDevice detach PCI device +// DetachPciDevice detaches PCI device func (c Compute) DetachPciDevice(ctx context.Context, req DetachPCIDeviceRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/detachPciDevice" diff --git a/pkg/cloudbroker/compute/disable.go b/pkg/cloudbroker/compute/disable.go index a2ae8ad..2fd6e98 100644 --- a/pkg/cloudbroker/compute/disable.go +++ b/pkg/cloudbroker/compute/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable compute +// DisableRequest struct to disable compute type DisableRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type DisableRequest struct { func (c Compute) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/disable" diff --git a/pkg/cloudbroker/compute/disk_add.go b/pkg/cloudbroker/compute/disk_add.go index 8bb7eb1..12a3b8a 100644 --- a/pkg/cloudbroker/compute/disk_add.go +++ b/pkg/cloudbroker/compute/disk_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create and attach disk to compute +// DiskAddRequest struct to create and attach disk to compute type DiskAddRequest struct { // ID of compute instance // Required: true @@ -52,9 +52,7 @@ type DiskAddRequest struct { func (c Compute) DiskAdd(ctx context.Context, req DiskAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/diskAdd" diff --git a/pkg/cloudbroker/compute/disk_attach.go b/pkg/cloudbroker/compute/disk_attach.go index 4acc8ae..b90dd3d 100644 --- a/pkg/cloudbroker/compute/disk_attach.go +++ b/pkg/cloudbroker/compute/disk_attach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for attach disk to compute +// DiskAttachRequest struct to attach disk to compute type DiskAttachRequest struct { // ID of compute instance // Required: true @@ -31,9 +31,7 @@ type DiskAttachRequest struct { func (c Compute) DiskAttach(ctx context.Context, req DiskAttachRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/diskAttach" diff --git a/pkg/cloudbroker/compute/disk_del.go b/pkg/cloudbroker/compute/disk_del.go index e7f9d17..28cdef4 100644 --- a/pkg/cloudbroker/compute/disk_del.go +++ b/pkg/cloudbroker/compute/disk_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach and delete disk from compute +// DiskDelRequest struct to detach and delete disk from compute type DiskDelRequest struct { // ID of compute instance // Required: true @@ -27,13 +27,11 @@ type DiskDelRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// DiskDel delete disk and detach from compute +// DiskDel deletes disk and detaches it from compute func (c Compute) DiskDel(ctx context.Context, req DiskDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/diskDel" diff --git a/pkg/cloudbroker/compute/disk_detach.go b/pkg/cloudbroker/compute/disk_detach.go index d1e9aa0..908f7c7 100644 --- a/pkg/cloudbroker/compute/disk_detach.go +++ b/pkg/cloudbroker/compute/disk_detach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach disk from compute +// DiskDetachRequest struct to detach disk from compute type DiskDetachRequest struct { // ID of compute instance // Required: true @@ -23,13 +23,11 @@ type DiskDetachRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// DiskDetach detach disk from compute +// DiskDetach detaches disk from compute func (c Compute) DiskDetach(ctx context.Context, req DiskDetachRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/diskDetach" diff --git a/pkg/cloudbroker/compute/disk_qos.go b/pkg/cloudbroker/compute/disk_qos.go index 8428413..7c5fbce 100644 --- a/pkg/cloudbroker/compute/disk_qos.go +++ b/pkg/cloudbroker/compute/disk_qos.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for change QOS of the disk +// DiskQOSRequest struct to change QOS of the disk type DiskQOSRequest struct { // ID of compute instance // Required: true @@ -27,13 +27,11 @@ type DiskQOSRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// DiskQOS change QOS of the disk +// DiskQOS changes QOS of the disk func (c Compute) DiskQOS(ctx context.Context, req DiskQOSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/diskQos" diff --git a/pkg/cloudbroker/compute/disk_resize.go b/pkg/cloudbroker/compute/disk_resize.go index 861f0d5..16543a4 100644 --- a/pkg/cloudbroker/compute/disk_resize.go +++ b/pkg/cloudbroker/compute/disk_resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for change disk size +// DiskResizeRequest struct to change disk size type DiskResizeRequest struct { // ID of compute instance // Required: true @@ -27,13 +27,11 @@ type DiskResizeRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// DiskResize change disk size +// DiskResize changes disk size func (c Compute) DiskResize(ctx context.Context, req DiskResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/diskResize" diff --git a/pkg/cloudbroker/compute/enable.go b/pkg/cloudbroker/compute/enable.go index 8dc5fe3..5afbcb1 100644 --- a/pkg/cloudbroker/compute/enable.go +++ b/pkg/cloudbroker/compute/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable compute +// EnableRequest struct to enable compute type EnableRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type EnableRequest struct { func (c Compute) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/enable" diff --git a/pkg/cloudbroker/compute/get.go b/pkg/cloudbroker/compute/get.go index 51a3c32..6c8470a 100644 --- a/pkg/cloudbroker/compute/get.go +++ b/pkg/cloudbroker/compute/get.go @@ -40,9 +40,7 @@ func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error func (c Compute) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/get" diff --git a/pkg/cloudbroker/compute/get_audits.go b/pkg/cloudbroker/compute/get_audits.go index e8c62e1..5626d4b 100644 --- a/pkg/cloudbroker/compute/get_audits.go +++ b/pkg/cloudbroker/compute/get_audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get compute audits +// GetAuditsRequest struct to get compute audits type GetAuditsRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type GetAuditsRequest struct { func (c Compute) GetAudits(ctx context.Context, req GetAuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/getAudits" diff --git a/pkg/cloudbroker/compute/get_console_url.go b/pkg/cloudbroker/compute/get_console_url.go index 9ae4888..0b9c6aa 100644 --- a/pkg/cloudbroker/compute/get_console_url.go +++ b/pkg/cloudbroker/compute/get_console_url.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get console URL +// GetConsoleURLRequest struct to get console URL type GetConsoleURLRequest struct { // ID of compute instance to get console for // Required: true @@ -19,9 +19,7 @@ type GetConsoleURLRequest struct { func (c Compute) GetConsoleURL(ctx context.Context, req GetConsoleURLRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/getConsoleUrl" diff --git a/pkg/cloudbroker/compute/get_log.go b/pkg/cloudbroker/compute/get_log.go index 910bb3d..25881aa 100644 --- a/pkg/cloudbroker/compute/get_log.go +++ b/pkg/cloudbroker/compute/get_log.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get compute logs +// GetLogRequest struct to get compute logs type GetLogRequest struct { // ID of compute instance to get log for // Required: true @@ -22,9 +22,7 @@ type GetLogRequest struct { func (c Compute) GetLog(ctx context.Context, req GetLogRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/getLog" diff --git a/pkg/cloudbroker/compute/list_deleted.go b/pkg/cloudbroker/compute/list_deleted.go index dac24da..2ae9b95 100644 --- a/pkg/cloudbroker/compute/list_deleted.go +++ b/pkg/cloudbroker/compute/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get deleted computes list +// ListDeletedRequest struct to get deleted computes list type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudbroker/compute/list_pci_device.go b/pkg/cloudbroker/compute/list_pci_device.go index 197cf78..d31a1d7 100644 --- a/pkg/cloudbroker/compute/list_pci_device.go +++ b/pkg/cloudbroker/compute/list_pci_device.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list PCI devices +// ListPCIDeviceRequest struct to get list of PCI devices type ListPCIDeviceRequest struct { // Identifier compute // Required: true @@ -39,13 +39,11 @@ type ListPCIDeviceRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListPCIDevice gets list PCI device +// ListPCIDevice gets list of PCI device func (c Compute) ListPCIDevice(ctx context.Context, req ListPCIDeviceRequest) (*ListPCIDevices, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/listPciDevice" diff --git a/pkg/cloudbroker/compute/list_vgpu.go b/pkg/cloudbroker/compute/list_vgpu.go index a57ea9f..5a023b4 100644 --- a/pkg/cloudbroker/compute/list_vgpu.go +++ b/pkg/cloudbroker/compute/list_vgpu.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list GPU for compute +// ListVGPURequest struct to get list of GPU for compute type ListVGPURequest struct { // ID of compute instance // Required: true @@ -39,13 +39,11 @@ type ListVGPURequest struct { IncludeDeleted bool `url:"includedeleted,omitempty" json:"includedeleted,omitempty"` } -// ListVGPU gets list GPU for compute +// ListVGPU gets list of GPU for compute func (c Compute) ListVGPU(ctx context.Context, req ListVGPURequest) (*ListVGPUs, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/listVGpu" diff --git a/pkg/cloudbroker/compute/mass_delete.go b/pkg/cloudbroker/compute/mass_delete.go index 048da6b..e4abefc 100644 --- a/pkg/cloudbroker/compute/mass_delete.go +++ b/pkg/cloudbroker/compute/mass_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete several computes +// MassDeleteRequest struct to delete several computes type MassDeleteRequest struct { // IDs of compute instances to delete // Required: true @@ -27,9 +27,7 @@ type MassDeleteRequest struct { func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/massDelete" diff --git a/pkg/cloudbroker/compute/mass_reboot.go b/pkg/cloudbroker/compute/mass_reboot.go index f33426b..973e523 100644 --- a/pkg/cloudbroker/compute/mass_reboot.go +++ b/pkg/cloudbroker/compute/mass_reboot.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reboot several computes +// MassRebootRequest struct to reboot several computes type MassRebootRequest struct { // IDs of compute instances to reboot // Required: true @@ -23,9 +23,7 @@ type MassRebootRequest struct { func (c Compute) MassReboot(ctx context.Context, req MassRebootRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/massReboot" diff --git a/pkg/cloudbroker/compute/mass_repair_boot_fs.go b/pkg/cloudbroker/compute/mass_repair_boot_fs.go index d427189..525d837 100644 --- a/pkg/cloudbroker/compute/mass_repair_boot_fs.go +++ b/pkg/cloudbroker/compute/mass_repair_boot_fs.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for repair boot disk filesystem on several computes +// MassRepairBootFSRequest struct to repair boot disk filesystem on several computes type MassRepairBootFSRequest struct { // IDs of compute instances which boot file systems will be repaired // Required: true @@ -19,13 +19,11 @@ type MassRepairBootFSRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// MassRepairBootFS repair boot disk filesystem on several computes +// MassRepairBootFS repairs boot disk filesystem on several computes func (c Compute) MassRepairBootFS(ctx context.Context, req MassRepairBootFSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/massRepairBootFs" diff --git a/pkg/cloudbroker/compute/mass_start.go b/pkg/cloudbroker/compute/mass_start.go index ab87808..e6684cb 100644 --- a/pkg/cloudbroker/compute/mass_start.go +++ b/pkg/cloudbroker/compute/mass_start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start several computes +// MassStartRequest struct to start several computes type MassStartRequest struct { // IDs of compute instances to start // Required: true @@ -23,9 +23,7 @@ type MassStartRequest struct { func (c Compute) MassStart(ctx context.Context, req MassStartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/massStart" diff --git a/pkg/cloudbroker/compute/mass_stop.go b/pkg/cloudbroker/compute/mass_stop.go index 83cc054..cbbe2f5 100644 --- a/pkg/cloudbroker/compute/mass_stop.go +++ b/pkg/cloudbroker/compute/mass_stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for several stop computes +// MassStopRequest struct to stop several computes type MassStopRequest struct { // IDs of compute instances to stop // Required: true @@ -27,9 +27,7 @@ type MassStopRequest struct { func (c Compute) MassStop(ctx context.Context, req MassStopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/massStop" diff --git a/pkg/cloudbroker/compute/migrate.go b/pkg/cloudbroker/compute/migrate.go index 9645366..f1245ca 100644 --- a/pkg/cloudbroker/compute/migrate.go +++ b/pkg/cloudbroker/compute/migrate.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for migrate compute +// MigrateRequest struct to migrate compute type MigrateRequest struct { // ID of compute instance // Required: true @@ -32,9 +32,7 @@ type MigrateRequest struct { func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrate" diff --git a/pkg/cloudbroker/compute/migrate_storage.go b/pkg/cloudbroker/compute/migrate_storage.go index 1824e83..712920f 100644 --- a/pkg/cloudbroker/compute/migrate_storage.go +++ b/pkg/cloudbroker/compute/migrate_storage.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for migration +// MigrateStorageRequest struct for migration type MigrateStorageRequest struct { // ID of the compute instance // Required: true @@ -38,9 +38,7 @@ type MigrateStorageRequest struct { func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrateStorage" diff --git a/pkg/cloudbroker/compute/migrate_storage_abort.go b/pkg/cloudbroker/compute/migrate_storage_abort.go index d52401e..7b27ab9 100644 --- a/pkg/cloudbroker/compute/migrate_storage_abort.go +++ b/pkg/cloudbroker/compute/migrate_storage_abort.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for abort migration +// MigrateStorageAbortRequest struct to abort migration type MigrateStorageAbortRequest struct { // ID of the compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// MigrateStorageAbort abort complex compute migration job +// MigrateStorageAbort aborts complex compute migration job func (c Compute) MigrateStorageAbort(ctx context.Context, req MigrateStorageAbortRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrateStorageAbort" diff --git a/pkg/cloudbroker/compute/migrate_storage_clean_up.go b/pkg/cloudbroker/compute/migrate_storage_clean_up.go index 68d8275..07522e7 100644 --- a/pkg/cloudbroker/compute/migrate_storage_clean_up.go +++ b/pkg/cloudbroker/compute/migrate_storage_clean_up.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for cleanup resources after finished migration +// MigrateStorageCleanUpRequest struct to cleanup resources after finished migration type MigrateStorageCleanUpRequest struct { // ID of the compute instance // Required: true @@ -21,9 +21,7 @@ type MigrateStorageCleanUpRequest struct { func (c Compute) MigrateStorageCleanUp(ctx context.Context, req MigrateStorageCleanUpRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrateStorageCleanup" diff --git a/pkg/cloudbroker/compute/migrate_storage_info.go b/pkg/cloudbroker/compute/migrate_storage_info.go index 4fb8806..305dcc0 100644 --- a/pkg/cloudbroker/compute/migrate_storage_info.go +++ b/pkg/cloudbroker/compute/migrate_storage_info.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get info about migration +// MigrateStorageInfoRequest struct to get info about migration type MigrateStorageInfoRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type MigrateStorageInfoRequest struct { func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrateStorageInfo" diff --git a/pkg/cloudbroker/compute/move_to_rg.go b/pkg/cloudbroker/compute/move_to_rg.go index f7e6e76..38e6d31 100644 --- a/pkg/cloudbroker/compute/move_to_rg.go +++ b/pkg/cloudbroker/compute/move_to_rg.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for move compute new resource group +// MoveToRGRequest struct to move compute to new resource group type MoveToRGRequest struct { // ID of the compute instance to move // Required: true @@ -38,9 +38,7 @@ type MoveToRGRequest struct { func (c Compute) Validate(ctx context.Context, req MoveToRGRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/moveToRg" diff --git a/pkg/cloudbroker/compute/net_attach.go b/pkg/cloudbroker/compute/net_attach.go index 3b13667..dc49488 100644 --- a/pkg/cloudbroker/compute/net_attach.go +++ b/pkg/cloudbroker/compute/net_attach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for attach network +// NetAttachRequest struct to attach network type NetAttachRequest struct { // ID of compute instance // Required: true @@ -35,13 +35,11 @@ type NetAttachRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// NetAttach attach network to compute and gets info about network +// NetAttach attaches network to compute and gets info about network func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNetAttach, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/netAttach" diff --git a/pkg/cloudbroker/compute/net_detach.go b/pkg/cloudbroker/compute/net_detach.go index 6ce79df..ada6365 100644 --- a/pkg/cloudbroker/compute/net_detach.go +++ b/pkg/cloudbroker/compute/net_detach.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for detach networ to compute +// NetDetachRequest struct to detach network from compute type NetDetachRequest struct { // ID of compute instance // Required: true @@ -27,13 +27,11 @@ type NetDetachRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// NetDetach detach network to compute +// NetDetach detaches network from compute func (c Compute) NetDetach(ctx context.Context, req NetDetachRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/netDetach" diff --git a/pkg/cloudbroker/compute/net_qos.go b/pkg/cloudbroker/compute/net_qos.go index a6e8cab..b187ad9 100644 --- a/pkg/cloudbroker/compute/net_qos.go +++ b/pkg/cloudbroker/compute/net_qos.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update QOS +// NetQOSRequest struct for update QOS type NetQOSRequest struct { // ID of compute instance // Required: true @@ -38,13 +38,11 @@ type NetQOSRequest struct { EgressRate uint64 `url:"egress_rate,omitempty" json:"egress_rate,omitempty"` } -// NetQOS update compute interfaces QOS +// NetQOS updates compute interfaces QOS func (c Compute) NetQOS(ctx context.Context, req NetQOSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/netQos" diff --git a/pkg/cloudbroker/compute/pause.go b/pkg/cloudbroker/compute/pause.go index b5d0460..0ba05d4 100644 --- a/pkg/cloudbroker/compute/pause.go +++ b/pkg/cloudbroker/compute/pause.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for pause compute +// PauseRequest struct to pause compute type PauseRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type PauseRequest struct { func (c Compute) Pause(ctx context.Context, req PauseRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/pause" diff --git a/pkg/cloudbroker/compute/pfw_add.go b/pkg/cloudbroker/compute/pfw_add.go index 8863451..749c453 100644 --- a/pkg/cloudbroker/compute/pfw_add.go +++ b/pkg/cloudbroker/compute/pfw_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add port forward rule +// PFWAddRequest struct to add port forward rule type PFWAddRequest struct { // ID of compute instance // Required: true @@ -39,13 +39,11 @@ type PFWAddRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// PFWAdd add port forward rule +// PFWAdd adds port forward rule func (c Compute) PFWAdd(ctx context.Context, req PFWAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/pfwAdd" diff --git a/pkg/cloudbroker/compute/pfw_del.go b/pkg/cloudbroker/compute/pfw_del.go index 0d3221a..8119c9d 100644 --- a/pkg/cloudbroker/compute/pfw_del.go +++ b/pkg/cloudbroker/compute/pfw_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete port forward rule +// PFWDelRequest struct to delete port forward rule type PFWDelRequest struct { // ID of compute instance // Required: true @@ -42,13 +42,11 @@ type PFWDelRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// PFWDel delete port forward rule +// PFWDel deletes port forward rule func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/pfwDel" diff --git a/pkg/cloudbroker/compute/pfw_list.go b/pkg/cloudbroker/compute/pfw_list.go index 4fadaa1..7d1751e 100644 --- a/pkg/cloudbroker/compute/pfw_list.go +++ b/pkg/cloudbroker/compute/pfw_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list port forwards +// PFWListRequest struct to get list of port forwards type PFWListRequest struct { // ID of compute instance // Required: true @@ -23,9 +23,7 @@ type PFWListRequest struct { func (c Compute) PFWList(ctx context.Context, req PFWListRequest) (ListPFW, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/pfwList" diff --git a/pkg/cloudbroker/compute/pin_to_stack.go b/pkg/cloudbroker/compute/pin_to_stack.go index 9d4dfd7..7531c49 100644 --- a/pkg/cloudbroker/compute/pin_to_stack.go +++ b/pkg/cloudbroker/compute/pin_to_stack.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for pin comptute to stack +// PinToStackRequest struct to pin compute to stack type PinToStackRequest struct { // ID of the compute instance // Required: true @@ -23,13 +23,11 @@ type PinToStackRequest struct { Force bool `url:"force" json:"force"` } -// PinToStack pin compute to current stack +// PinToStack pins compute to current stack func (c Compute) PinToStack(ctx context.Context, req PinToStackRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/pinToStack" diff --git a/pkg/cloudbroker/compute/power_cycle.go b/pkg/cloudbroker/compute/power_cycle.go index 60b53a7..7c25360 100644 --- a/pkg/cloudbroker/compute/power_cycle.go +++ b/pkg/cloudbroker/compute/power_cycle.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for force stop and start compute +// PowerCycleRequest struct to force stop and start compute type PowerCycleRequest struct { // ID of compute instance // Required: true @@ -19,9 +19,7 @@ type PowerCycleRequest struct { func (c Compute) PowerCycle(ctx context.Context, req PowerCycleRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/powerCycle" diff --git a/pkg/cloudbroker/compute/reboot.go b/pkg/cloudbroker/compute/reboot.go index 1859170..b66d910 100644 --- a/pkg/cloudbroker/compute/reboot.go +++ b/pkg/cloudbroker/compute/reboot.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reboot compute +// RebootRequest struct to reboot compute type RebootRequest struct { // ID of compute instance // Required: true @@ -19,13 +19,11 @@ type RebootRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Reboot reboot compute +// Reboot reboots compute func (c Compute) Reboot(ctx context.Context, req RebootRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/reboot" diff --git a/pkg/cloudbroker/compute/redeploy.go b/pkg/cloudbroker/compute/redeploy.go index 7c61058..4bf3512 100644 --- a/pkg/cloudbroker/compute/redeploy.go +++ b/pkg/cloudbroker/compute/redeploy.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for redeploy +// RedeployRequest struct for redeploy type RedeployRequest struct { // ID of compute instance // Required: true @@ -43,13 +43,11 @@ type RedeployRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Redeploy redeploy compute +// Redeploy redeploys compute func (c Compute) Redeploy(ctx context.Context, req RedeployRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/redeploy" diff --git a/pkg/cloudbroker/compute/registration.go b/pkg/cloudbroker/compute/registration.go index e89ec3c..f942b8a 100644 --- a/pkg/cloudbroker/compute/registration.go +++ b/pkg/cloudbroker/compute/registration.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set compute registered in RT +// RegistrationRequest struct to set compute registered in RT type RegistrationRequest struct { // ID of the Compute // Required: true @@ -23,9 +23,7 @@ type RegistrationRequest struct { func (c Compute) Registration(ctx context.Context, req RegistrationRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/registration" diff --git a/pkg/cloudbroker/compute/repair_boot_fs.go b/pkg/cloudbroker/compute/repair_boot_fs.go index c52f5f4..85da19e 100644 --- a/pkg/cloudbroker/compute/repair_boot_fs.go +++ b/pkg/cloudbroker/compute/repair_boot_fs.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for repair filesystem +// RepairBootFSRequest struct to repair filesystem type RepairBootFSRequest struct { // ID of compute instance // Required: true @@ -19,13 +19,11 @@ type RepairBootFSRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// RepairBootFS repair compute boot disk filesystem +// RepairBootFS repairs compute boot disk filesystem func (c Compute) RepairBootFS(ctx context.Context, req RepairBootFSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/repairBootFs" diff --git a/pkg/cloudbroker/compute/reset.go b/pkg/cloudbroker/compute/reset.go index ed34749..81b083e 100644 --- a/pkg/cloudbroker/compute/reset.go +++ b/pkg/cloudbroker/compute/reset.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reset compute +// ResetRequest struct to reset compute type ResetRequest struct { // ID of compute instance // Required: true @@ -19,13 +19,11 @@ type ResetRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Reset reset compute +// Reset resets compute func (c Compute) Reset(ctx context.Context, req ResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/reset" diff --git a/pkg/cloudbroker/compute/resize.go b/pkg/cloudbroker/compute/resize.go index 5e88bc7..eff6f2d 100644 --- a/pkg/cloudbroker/compute/resize.go +++ b/pkg/cloudbroker/compute/resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resize compute +// ResizeRequest struct to resize compute type ResizeRequest struct { // ID of compute instance // Required: true @@ -33,13 +33,11 @@ type ResizeRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Resize resize compute instance +// Resize resizes compute instance func (c Compute) Resize(ctx context.Context, req ResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/resize" diff --git a/pkg/cloudbroker/compute/restore.go b/pkg/cloudbroker/compute/restore.go index 6dce42d..36ee737 100644 --- a/pkg/cloudbroker/compute/restore.go +++ b/pkg/cloudbroker/compute/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore compute +// RestoreRequest struct to restore compute type RestoreRequest struct { // ID of compute instance // Required: true @@ -19,13 +19,11 @@ type RestoreRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Restore restore compute from recycle bin +// Restore restores compute from recycle bin func (c Compute) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/restore" diff --git a/pkg/cloudbroker/compute/resume.go b/pkg/cloudbroker/compute/resume.go index e1635c1..4726787 100644 --- a/pkg/cloudbroker/compute/resume.go +++ b/pkg/cloudbroker/compute/resume.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resume compute +// ResumeRequest struct to resume compute type ResumeRequest struct { // ID of compute instance // Required: true @@ -19,13 +19,11 @@ type ResumeRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Resume resume Compute from paused state +// Resume resumes Compute from paused state func (c Compute) Resume(ctx context.Context, req ResumeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/resume" diff --git a/pkg/cloudbroker/compute/set_custom_fields.go b/pkg/cloudbroker/compute/set_custom_fields.go index aea4d9e..88eb115 100644 --- a/pkg/cloudbroker/compute/set_custom_fields.go +++ b/pkg/cloudbroker/compute/set_custom_fields.go @@ -7,7 +7,8 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for setting customFields values for the Compute + +// SetCustomFieldsRequest struct for setting customFields values for the Compute type SetCustomFieldsRequest struct { // ID of the compute // Required: true @@ -22,9 +23,7 @@ type SetCustomFieldsRequest struct { func (c Compute) SetCustomFields(ctx context.Context, req SetCustomFieldsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/setCustomFields" diff --git a/pkg/cloudbroker/compute/snapshot_create.go b/pkg/cloudbroker/compute/snapshot_create.go index 10d134b..d160d4b 100644 --- a/pkg/cloudbroker/compute/snapshot_create.go +++ b/pkg/cloudbroker/compute/snapshot_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create snapshot +// SnapshotCreateRequest struct to create snapshot type SnapshotCreateRequest struct { // ID of the compute instance to create snapshot for // Required: true @@ -20,13 +20,11 @@ type SnapshotCreateRequest struct { Label string `url:"label" json:"label" validate:"required"` } -// SnapshotCreate create compute snapshot +// SnapshotCreate creates compute snapshot func (c Compute) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/snapshotCreate" diff --git a/pkg/cloudbroker/compute/snapshot_delete.go b/pkg/cloudbroker/compute/snapshot_delete.go index a97ed53..7b2ff92 100644 --- a/pkg/cloudbroker/compute/snapshot_delete.go +++ b/pkg/cloudbroker/compute/snapshot_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete snapshot +// SnapshotDeleteRequest struct to delete snapshot type SnapshotDeleteRequest struct { // ID of the compute instance // Required: true @@ -19,13 +19,11 @@ type SnapshotDeleteRequest struct { Label string `url:"label" json:"label" validate:"required"` } -// SnapshotDelete delete specified compute snapshot +// SnapshotDelete deletes specified compute snapshot func (c Compute) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/snapshotDelete" diff --git a/pkg/cloudbroker/compute/snapshot_evict_disk.go b/pkg/cloudbroker/compute/snapshot_evict_disk.go index d2a9e8a..ecef14a 100644 --- a/pkg/cloudbroker/compute/snapshot_evict_disk.go +++ b/pkg/cloudbroker/compute/snapshot_evict_disk.go @@ -8,24 +8,22 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for evict specified disk +// SnapshotEvictDiskRequest struct to evict specified disk type SnapshotEvictDiskRequest struct { // ID of the compute instance // Required: true - ComputeID uint64 `url:"computeId" json:"computeId" valdiate:"required"` + ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` // ID of the disk instance // Required: true DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` } -// SnapshotEvictDisk evict specified disk from all snapshots of a compute instance +// SnapshotEvictDisk evicts specified disk from all snapshots of a compute instance func (c Compute) SnapshotEvictDisk(ctx context.Context, req SnapshotEvictDiskRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/snapshotEvictDisk" diff --git a/pkg/cloudbroker/compute/snapshot_list.go b/pkg/cloudbroker/compute/snapshot_list.go index ec52356..02e78f1 100644 --- a/pkg/cloudbroker/compute/snapshot_list.go +++ b/pkg/cloudbroker/compute/snapshot_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list snapshots +// SnapshotListRequest struct to get list of snapshots type SnapshotListRequest struct { // ID of the compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// SnapshotList gets list compute snapshots +// SnapshotList gets list of compute snapshots func (c Compute) SnapshotList(ctx context.Context, req SnapshotListRequest) (ListSnapshots, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/snapshotList" diff --git a/pkg/cloudbroker/compute/snapshot_rollback.go b/pkg/cloudbroker/compute/snapshot_rollback.go index 1206290..b72cb91 100644 --- a/pkg/cloudbroker/compute/snapshot_rollback.go +++ b/pkg/cloudbroker/compute/snapshot_rollback.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rollback +// SnapshotRollbackRequest struct for rollback type SnapshotRollbackRequest struct { // ID of the compute instance // Required: true @@ -19,13 +19,11 @@ type SnapshotRollbackRequest struct { Label string `url:"label" json:"label" validate:"required"` } -// SnapshotRollback rollback specified compute snapshot +// SnapshotRollback rollbacks specified compute snapshot func (c Compute) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/snapshotRollback" diff --git a/pkg/cloudbroker/compute/snapshot_usage.go b/pkg/cloudbroker/compute/snapshot_usage.go index 33c34fe..12bf3ed 100644 --- a/pkg/cloudbroker/compute/snapshot_usage.go +++ b/pkg/cloudbroker/compute/snapshot_usage.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get compute snapshot real size on storage +// SnapshotUsageRequest struct tto get compute snapshot real size on storage type SnapshotUsageRequest struct { // ID of the compute instance // Required: true @@ -20,15 +20,13 @@ type SnapshotUsageRequest struct { Label string `url:"label,omitempty" json:"label,omitempty"` } -// SnapshotUsage Get compute snapshot real size on storage. +// SnapshotUsage gets compute snapshot real size on storage. // Always returns list of json objects, and first json object contains summary about all related // snapshots. func (c Compute) SnapshotUsage(ctx context.Context, req SnapshotUsageRequest) (ListSnapshotUsage, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/snapshotUsage" diff --git a/pkg/cloudbroker/compute/start.go b/pkg/cloudbroker/compute/start.go index 187c7ad..c6a20a6 100644 --- a/pkg/cloudbroker/compute/start.go +++ b/pkg/cloudbroker/compute/start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start compute +// StartRequest struct to start compute type StartRequest struct { // ID of compute instance // Required: true @@ -31,9 +31,7 @@ type StartRequest struct { func (c Compute) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/start" diff --git a/pkg/cloudbroker/compute/stop.go b/pkg/cloudbroker/compute/stop.go index 1dc6a1d..a5b1e34 100644 --- a/pkg/cloudbroker/compute/stop.go +++ b/pkg/cloudbroker/compute/stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop compute +// StopRequest struct to stop compute type StopRequest struct { // ID of compute instance // Required: true @@ -27,9 +27,7 @@ type StopRequest struct { func (c Compute) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/stop" diff --git a/pkg/cloudbroker/compute/tag_add.go b/pkg/cloudbroker/compute/tag_add.go index 67e6669..737115f 100644 --- a/pkg/cloudbroker/compute/tag_add.go +++ b/pkg/cloudbroker/compute/tag_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add tag to compute +// TagAddRequest struct to add tag to compute type TagAddRequest struct { // IDs of the compute instances // Required: true @@ -23,13 +23,11 @@ type TagAddRequest struct { Value string `url:"value" json:"value" validate:"required"` } -// TagAdd add tag to compute tags dict +// TagAdd adds tag to compute tags dict func (c Compute) TagAdd(ctx context.Context, req TagAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/tagAdd" diff --git a/pkg/cloudbroker/compute/tag_remove.go b/pkg/cloudbroker/compute/tag_remove.go index c70d579..70ea2a7 100644 --- a/pkg/cloudbroker/compute/tag_remove.go +++ b/pkg/cloudbroker/compute/tag_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove tag from compute +// TagRemoveRequest struct to remove tag from compute type TagRemoveRequest struct { // IDs of the compute instances // Required: true @@ -23,9 +23,7 @@ type TagRemoveRequest struct { func (c Compute) TagRemove(ctx context.Context, req TagRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/tagRemove" diff --git a/pkg/cloudbroker/compute/unpin_from_stack.go b/pkg/cloudbroker/compute/unpin_from_stack.go index 36402cc..ba7b1bc 100644 --- a/pkg/cloudbroker/compute/unpin_from_stack.go +++ b/pkg/cloudbroker/compute/unpin_from_stack.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for unpin from stack +// UnpinFromStackRequest struct to unpin from stack type UnpinFromStackRequest struct { // ID of the compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// UnpinFromStack unpin compute from current stack +// UnpinFromStack unpins compute from current stack func (c Compute) UnpinFromStack(ctx context.Context, req UnpinFromStackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/unpinFromStack" diff --git a/pkg/cloudbroker/compute/update.go b/pkg/cloudbroker/compute/update.go index 46be1dd..b8ff1a5 100644 --- a/pkg/cloudbroker/compute/update.go +++ b/pkg/cloudbroker/compute/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update compute +// UpdateRequest struct to update compute type UpdateRequest struct { // ID of the compute // Required: true @@ -31,9 +31,7 @@ type UpdateRequest struct { func (c Compute) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/update" diff --git a/pkg/cloudbroker/compute/user_grant.go b/pkg/cloudbroker/compute/user_grant.go index 28f71e2..f270958 100644 --- a/pkg/cloudbroker/compute/user_grant.go +++ b/pkg/cloudbroker/compute/user_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to compute +// UserGrantRequest struct to grant access to compute type UserGrantRequest struct { // ID of the compute instance // Required: true @@ -27,13 +27,11 @@ type UserGrantRequest struct { AccessType string `url:"accesstype" json:"accesstype" validate:"accessType"` } -// UserGrant grant user access to the compute +// UserGrant grants user access to the compute func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/userGrant" diff --git a/pkg/cloudbroker/compute/user_list.go b/pkg/cloudbroker/compute/user_list.go index 0433ee2..586d9e9 100644 --- a/pkg/cloudbroker/compute/user_list.go +++ b/pkg/cloudbroker/compute/user_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list users for compute +// UserListRequest struct to get list of users for compute type UserListRequest struct { // ID of the compute instance // Required: true @@ -19,9 +19,7 @@ type UserListRequest struct { func (c Compute) UserList(ctx context.Context, req UserListRequest) (*RecordACL, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/userList" diff --git a/pkg/cloudbroker/compute/user_revoke.go b/pkg/cloudbroker/compute/user_revoke.go index cdf03ba..1e04011 100644 --- a/pkg/cloudbroker/compute/user_revoke.go +++ b/pkg/cloudbroker/compute/user_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke user access +// UserRevokeRequest struct to revoke user access type UserRevokeRequest struct { // ID of the compute instance // Required: true @@ -23,9 +23,7 @@ type UserRevokeRequest struct { func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/userRevoke" diff --git a/pkg/cloudbroker/compute/user_update.go b/pkg/cloudbroker/compute/user_update.go index 5e0867e..67fe425 100644 --- a/pkg/cloudbroker/compute/user_update.go +++ b/pkg/cloudbroker/compute/user_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update user access +// UserUpdateRequest struct to update user access type UserUpdateRequest struct { // ID of the compute instance // Required: true @@ -31,9 +31,7 @@ type UserUpdateRequest struct { func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/userUpdate" diff --git a/pkg/cloudbroker/disks/create.go b/pkg/cloudbroker/disks/create.go index 4d697f7..5265017 100644 --- a/pkg/cloudbroker/disks/create.go +++ b/pkg/cloudbroker/disks/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create disk +// CreateRequest struct to create disk type CreateRequest struct { // ID of the account // Required: true @@ -58,9 +58,7 @@ type CreateRequest struct { func (d Disks) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/create" diff --git a/pkg/cloudbroker/disks/delete.go b/pkg/cloudbroker/disks/delete.go index 0207237..0408db5 100644 --- a/pkg/cloudbroker/disks/delete.go +++ b/pkg/cloudbroker/disks/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request for delete disk +// DeleteRequest struct to delete disk type DeleteRequest struct { // ID of disk to delete // Required: true @@ -31,9 +31,7 @@ type DeleteRequest struct { func (d Disks) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/delete" diff --git a/pkg/cloudbroker/disks/delete_disks.go b/pkg/cloudbroker/disks/delete_disks.go index b362f2b..7c6a228 100644 --- a/pkg/cloudbroker/disks/delete_disks.go +++ b/pkg/cloudbroker/disks/delete_disks.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for multiple disks +// DeleteDisksRequest struct for multiple disks type DeleteDisksRequest struct { // List of disk ids to delete // Required: true @@ -27,9 +27,7 @@ type DeleteDisksRequest struct { func (d Disks) DeleteDisks(ctx context.Context, req DeleteDisksRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/deleteDisks" diff --git a/pkg/cloudbroker/disks/get.go b/pkg/cloudbroker/disks/get.go index 5772c52..0a3b3a3 100644 --- a/pkg/cloudbroker/disks/get.go +++ b/pkg/cloudbroker/disks/get.go @@ -38,9 +38,7 @@ func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) { func (d Disks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/get" diff --git a/pkg/cloudbroker/disks/limit_io.go b/pkg/cloudbroker/disks/limit_io.go index 5e069d4..693b8f6 100644 --- a/pkg/cloudbroker/disks/limit_io.go +++ b/pkg/cloudbroker/disks/limit_io.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for limit IO +// LimitIORequest struct for limit IO type LimitIORequest struct { // ID of the disk to limit // Required: true @@ -71,15 +71,13 @@ type LimitIORequest struct { SizeIOPSSec uint64 `url:"size_iops_sec,omitempty" json:"size_iops_sec,omitempty"` } -// LimitIO limit IO for a certain disk +// LimitIO limits IO for a certain disk // total and read/write options are not allowed to be combined // see http://libvirt.org/formatdomain.html#elementsDisks iotune section for more details func (d Disks) LimitIO(ctx context.Context, req LimitIORequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/limitIO" diff --git a/pkg/cloudbroker/disks/list_deleted.go b/pkg/cloudbroker/disks/list_deleted.go index 78d099c..7fa8582 100644 --- a/pkg/cloudbroker/disks/list_deleted.go +++ b/pkg/cloudbroker/disks/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted disks +// ListDeletedRequest struct to get list of deleted disks type ListDeletedRequest struct { // Find by id // Required: false @@ -45,7 +45,7 @@ type ListDeletedRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListDeleted gets list the deleted disks based on filter +// ListDeleted gets list of the deleted disks based on filter func (d Disks) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListDisks, error) { url := "/cloudbroker/disks/listDeleted" diff --git a/pkg/cloudbroker/disks/list_types.go b/pkg/cloudbroker/disks/list_types.go index e591cc3..c87f4fa 100644 --- a/pkg/cloudbroker/disks/list_types.go +++ b/pkg/cloudbroker/disks/list_types.go @@ -4,11 +4,9 @@ import ( "context" "encoding/json" "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list types of disks +// ListTypesRequest struct to get list of types of disks type ListTypesRequest struct { // Show detailed disk types by seps // Required: false @@ -23,15 +21,8 @@ type ListTypesRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListTypes gets list defined disk types +// ListTypes gets list of defined disk types func (d Disks) ListTypes(ctx context.Context, req ListTypesRequest) (*ListTypes, error) { - err := validators.ValidateRequest(req) - if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } - } - url := "/cloudbroker/disks/listTypes" res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req) diff --git a/pkg/cloudbroker/disks/list_unattached.go b/pkg/cloudbroker/disks/list_unattached.go index 28ad146..0b509a8 100644 --- a/pkg/cloudbroker/disks/list_unattached.go +++ b/pkg/cloudbroker/disks/list_unattached.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list unattached disk +// ListUnattachedRequest struct to get list of unattached disk type ListUnattachedRequest struct { // Find by id // Required: false diff --git a/pkg/cloudbroker/disks/rename.go b/pkg/cloudbroker/disks/rename.go index 8419ae0..2c21ed4 100644 --- a/pkg/cloudbroker/disks/rename.go +++ b/pkg/cloudbroker/disks/rename.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rename disk +// RenameRequest struct to rename disk type RenameRequest struct { // ID of the disk to rename // Required: true @@ -19,13 +19,11 @@ type RenameRequest struct { Name string `url:"name" json:"name" validate:"required"` } -// Rename rename disk +// Rename renames disk func (d Disks) Rename(ctx context.Context, req RenameRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/rename" diff --git a/pkg/cloudbroker/disks/resize.go b/pkg/cloudbroker/disks/resize.go index 85a9287..07e4b08 100644 --- a/pkg/cloudbroker/disks/resize.go +++ b/pkg/cloudbroker/disks/resize.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for resize disk +// ResizeRequest struct to resize disk type ResizeRequest struct { // ID of the disk to resize // Required: true @@ -19,16 +19,14 @@ type ResizeRequest struct { Size uint64 `url:"size" json:"size" validate:"required"` } -// Resize resize disk +// Resize resizes disk // Returns 200 if disk is resized online, else will return 202, // in that case please stop and start your machine after changing the disk size, for your changes to be reflected. // This method will not be used for disks, assigned to computes. Only unassigned disks and disks, assigned with "old" virtual machines. func (d Disks) Resize(ctx context.Context, req ResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/resize" @@ -53,9 +51,7 @@ func (d Disks) Resize(ctx context.Context, req ResizeRequest) (bool, error) { func (d Disks) Resize2(ctx context.Context, req ResizeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/resize2" diff --git a/pkg/cloudbroker/disks/restore.go b/pkg/cloudbroker/disks/restore.go index 69acb1c..fc663cb 100644 --- a/pkg/cloudbroker/disks/restore.go +++ b/pkg/cloudbroker/disks/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore a deleted unattached disk +// RestoreRequest struct to restore a deleted unattached disk type RestoreRequest struct { // ID of the disk to restore // Required: true @@ -19,13 +19,11 @@ type RestoreRequest struct { Reason string `url:"reason" json:"reason" validate:"required"` } -// Restore restore a deleted unattached disk from recycle bin +// Restore restores a deleted unattached disk from recycle bin func (d Disks) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/restore" diff --git a/pkg/cloudbroker/disks/search.go b/pkg/cloudbroker/disks/search.go index 8f062e2..e4af863 100644 --- a/pkg/cloudbroker/disks/search.go +++ b/pkg/cloudbroker/disks/search.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for search +// SearchRequest struct for search type SearchRequest struct { // ID of the account to search for the Disk // Required: false @@ -28,7 +28,7 @@ type SearchRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// Search search disks +// Search searches disks func (d Disks) Search(ctx context.Context, req SearchRequest) (SearchListDisks, error) { url := "/cloudbroker/disks/search" diff --git a/pkg/cloudbroker/disks/share.go b/pkg/cloudbroker/disks/share.go index 9f34d21..57e94cc 100644 --- a/pkg/cloudbroker/disks/share.go +++ b/pkg/cloudbroker/disks/share.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for share data disk +// ShareRequest struct to share data disk type ShareRequest struct { // ID of the disk to share // Required: true @@ -19,9 +19,7 @@ type ShareRequest struct { func (d Disks) Share(ctx context.Context, req ShareRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/share" diff --git a/pkg/cloudbroker/disks/snapshot_delete.go b/pkg/cloudbroker/disks/snapshot_delete.go index 6e0fddd..c39647a 100644 --- a/pkg/cloudbroker/disks/snapshot_delete.go +++ b/pkg/cloudbroker/disks/snapshot_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete snapshot +// SnapshotDeleteRequest struct to delete snapshot type SnapshotDeleteRequest struct { // ID of disk to delete // Required: true @@ -23,9 +23,7 @@ type SnapshotDeleteRequest struct { func (d Disks) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/snapshotDelete" diff --git a/pkg/cloudbroker/disks/snapshot_rollback.go b/pkg/cloudbroker/disks/snapshot_rollback.go index b095a02..2b4a195 100644 --- a/pkg/cloudbroker/disks/snapshot_rollback.go +++ b/pkg/cloudbroker/disks/snapshot_rollback.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rollback snapshot +// SnapshotRollbackRequest struct to rollback snapshot type SnapshotRollbackRequest struct { // ID of the disk // Required: true @@ -23,13 +23,11 @@ type SnapshotRollbackRequest struct { TimeStamp uint64 `url:"timestamp,omitempty" json:"timestamp,omitempty"` } -// SnapshotRollback rollback an individual disk snapshot +// SnapshotRollback rollbacks an individual disk snapshot func (d Disks) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/snapshotRollback" diff --git a/pkg/cloudbroker/disks/unshare.go b/pkg/cloudbroker/disks/unshare.go index 68c26a8..bd3ff3b 100644 --- a/pkg/cloudbroker/disks/unshare.go +++ b/pkg/cloudbroker/disks/unshare.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for unshare data disk +// UnshareRequest struct to unshare data disk type UnshareRequest struct { // ID of the disk to unshare // Required: true @@ -19,9 +19,7 @@ type UnshareRequest struct { func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/disks/unshare" diff --git a/pkg/cloudbroker/extnet/access_add.go b/pkg/cloudbroker/extnet/access_add.go index b74fad9..368cf6e 100644 --- a/pkg/cloudbroker/extnet/access_add.go +++ b/pkg/cloudbroker/extnet/access_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access +// AccessAddRequest struct to grant access type AccessAddRequest struct { // ID of external network // Required: true @@ -19,13 +19,11 @@ type AccessAddRequest struct { AccountID uint64 `url:"accountId" json:"accountId" validate:"required"` } -// AccessAdd grant access to external network for account ID +// AccessAdd grants access to external network for account ID func (e ExtNet) AccessAdd(ctx context.Context, req AccessAddRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/accessAdd" diff --git a/pkg/cloudbroker/extnet/access_remove.go b/pkg/cloudbroker/extnet/access_remove.go index 42bb7c4..801a5b5 100644 --- a/pkg/cloudbroker/extnet/access_remove.go +++ b/pkg/cloudbroker/extnet/access_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove access +// AccessRemoveRequest struct to remove access type AccessRemoveRequest struct { // ID of external network // Required: true @@ -19,13 +19,11 @@ type AccessRemoveRequest struct { AccountID uint64 `url:"accountId" json:"accountId" validate:"required"` } -// AccessRemove remove access from external network for account ID +// AccessRemove removes access from external network for account ID func (e ExtNet) AccessRemove(ctx context.Context, req AccessRemoveRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/accessRemove" diff --git a/pkg/cloudbroker/extnet/create.go b/pkg/cloudbroker/extnet/create.go index 6745d17..7ea42c3 100644 --- a/pkg/cloudbroker/extnet/create.go +++ b/pkg/cloudbroker/extnet/create.go @@ -20,7 +20,7 @@ type Route struct { Gateway string `url:"gateway" json:"gateway" validate:"required"` } -// Request struct for create external network +// CreateRequest struct to create external network type CreateRequest struct { // External network name // Required: true @@ -97,9 +97,7 @@ type wrapperCreateRequest struct { func (e ExtNet) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var routes []string diff --git a/pkg/cloudbroker/extnet/default_qos_update.go b/pkg/cloudbroker/extnet/default_qos_update.go index 2556993..b120e64 100644 --- a/pkg/cloudbroker/extnet/default_qos_update.go +++ b/pkg/cloudbroker/extnet/default_qos_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update QOS +// DefaultQOSUpdateRequest struct for update QOS type DefaultQOSUpdateRequest struct { // ID of external network // Required: true @@ -31,9 +31,7 @@ type DefaultQOSUpdateRequest struct { func (e ExtNet) DefaultQOSUpdate(ctx context.Context, req DefaultQOSUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/defaultQosUpdate" diff --git a/pkg/cloudbroker/extnet/destroy.go b/pkg/cloudbroker/extnet/destroy.go index f9f9907..5dd54d0 100644 --- a/pkg/cloudbroker/extnet/destroy.go +++ b/pkg/cloudbroker/extnet/destroy.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for destroy +// DestroyRequest struct for destroy type DestroyRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type DestroyRequest struct { func (e ExtNet) Destroy(ctx context.Context, req DestroyRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/destroy" diff --git a/pkg/cloudbroker/extnet/device_deploy.go b/pkg/cloudbroker/extnet/device_deploy.go index ec16623..3aad871 100644 --- a/pkg/cloudbroker/extnet/device_deploy.go +++ b/pkg/cloudbroker/extnet/device_deploy.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for deploy network device +// DeviceDeployRequest struct to deploy network device type DeviceDeployRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type DeviceDeployRequest struct { func (e ExtNet) DeviceDeploy(ctx context.Context, req DeviceDeployRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/deviceDeploy" diff --git a/pkg/cloudbroker/extnet/device_migrate.go b/pkg/cloudbroker/extnet/device_migrate.go index 94aed76..c6c47df 100644 --- a/pkg/cloudbroker/extnet/device_migrate.go +++ b/pkg/cloudbroker/extnet/device_migrate.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for migrate VNF +// DeviceMigrateRequest struct for migrate VNF type DeviceMigrateRequest struct { // ID of external network // Required: true @@ -18,13 +18,11 @@ type DeviceMigrateRequest struct { StackID uint64 `url:"stackId" json:"stackId" validate:"required"` } -// DeviceMigrate migrate external network VNF device +// DeviceMigrate migrates external network VNF device func (e ExtNet) DeviceMigrate(ctx context.Context, req DeviceMigrateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/deviceMigrate" diff --git a/pkg/cloudbroker/extnet/device_remove.go b/pkg/cloudbroker/extnet/device_remove.go index b015cca..f460f02 100644 --- a/pkg/cloudbroker/extnet/device_remove.go +++ b/pkg/cloudbroker/extnet/device_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove network device +// DeviceRemoveRequest struct to remove network device type DeviceRemoveRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type DeviceRemoveRequest struct { func (e ExtNet) DeviceRemove(ctx context.Context, req DeviceRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/deviceRemove" diff --git a/pkg/cloudbroker/extnet/device_restart.go b/pkg/cloudbroker/extnet/device_restart.go index 583f29b..c8d37ab 100644 --- a/pkg/cloudbroker/extnet/device_restart.go +++ b/pkg/cloudbroker/extnet/device_restart.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restart VNF device +// DeviceRestartRequest struct for restart VNF device type DeviceRestartRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type DeviceRestartRequest struct { func (e ExtNet) DeviceRestart(ctx context.Context, req DeviceRestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/deviceRestart" diff --git a/pkg/cloudbroker/extnet/disable.go b/pkg/cloudbroker/extnet/disable.go index 9a1a736..bad244c 100644 --- a/pkg/cloudbroker/extnet/disable.go +++ b/pkg/cloudbroker/extnet/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable external network +// DisableRequest struct to disable external network type DisableRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (e ExtNet) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/disable" diff --git a/pkg/cloudbroker/extnet/dns_apply.go b/pkg/cloudbroker/extnet/dns_apply.go index db73215..04572b6 100644 --- a/pkg/cloudbroker/extnet/dns_apply.go +++ b/pkg/cloudbroker/extnet/dns_apply.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set new DNS +// DNSApplyRequest struct to set new DNS type DNSApplyRequest struct { // ID of external network // Required: true @@ -23,9 +23,7 @@ type DNSApplyRequest struct { func (e ExtNet) DNSApply(ctx context.Context, req DNSApplyRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/dnsApply" diff --git a/pkg/cloudbroker/extnet/enable.go b/pkg/cloudbroker/extnet/enable.go index 7026080..a87e810 100644 --- a/pkg/cloudbroker/extnet/enable.go +++ b/pkg/cloudbroker/extnet/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable external network +// EnableRequest struct to enable external network type EnableRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/enable" diff --git a/pkg/cloudbroker/extnet/get.go b/pkg/cloudbroker/extnet/get.go index 5b02977..fe4583a 100644 --- a/pkg/cloudbroker/extnet/get.go +++ b/pkg/cloudbroker/extnet/get.go @@ -36,9 +36,7 @@ func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error) func (e ExtNet) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/get" diff --git a/pkg/cloudbroker/extnet/ips_exclude.go b/pkg/cloudbroker/extnet/ips_exclude.go index 6f3d1cb..a98afc8 100644 --- a/pkg/cloudbroker/extnet/ips_exclude.go +++ b/pkg/cloudbroker/extnet/ips_exclude.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for exclude list IPs +// IPsExcludeRequest struct to exclude list of IPs type IPsExcludeRequest struct { // ID of external network // Required: true @@ -19,13 +19,11 @@ type IPsExcludeRequest struct { IPs []string `url:"ips" json:"ips" validate:"min=1"` } -// IPsExclude exclude list IPs from external network pool +// IPsExclude excludes list of IPs from external network pool func (e ExtNet) IPsExclude(ctx context.Context, req IPsExcludeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/ipsExclude" diff --git a/pkg/cloudbroker/extnet/ips_exclude_range.go b/pkg/cloudbroker/extnet/ips_exclude_range.go index 2649c3d..0fdd153 100644 --- a/pkg/cloudbroker/extnet/ips_exclude_range.go +++ b/pkg/cloudbroker/extnet/ips_exclude_range.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for exclude range of IPs +// IPsExcludeRangeRequest struct to exclude range of IPs type IPsExcludeRangeRequest struct { // ID of external network // Required: true @@ -23,13 +23,11 @@ type IPsExcludeRangeRequest struct { IPEnd string `url:"ip_end" json:"ip_end" validate:"required"` } -// IPsExcludeRange exclude range of IPs from external network pool +// IPsExcludeRange excludes range of IPs from external network pool func (e ExtNet) IPsExcludeRange(ctx context.Context, req IPsExcludeRangeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/ipsExcludeRange" diff --git a/pkg/cloudbroker/extnet/ips_include.go b/pkg/cloudbroker/extnet/ips_include.go index bfd5cad..9169385 100644 --- a/pkg/cloudbroker/extnet/ips_include.go +++ b/pkg/cloudbroker/extnet/ips_include.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for include list IPs +// IPsIncludeRequest struct to include list of IPs type IPsIncludeRequest struct { // ID of external network // Required: true @@ -19,13 +19,11 @@ type IPsIncludeRequest struct { IPs []string `url:"ips" json:"ips" validate:"min=1"` } -// IPsInclude include list IPs to external network pool +// IPsInclude includes list of IPs to external network pool func (e ExtNet) IPsInclude(ctx context.Context, req IPsIncludeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/ipsInclude" diff --git a/pkg/cloudbroker/extnet/ips_include_range.go b/pkg/cloudbroker/extnet/ips_include_range.go index 538f153..a811744 100644 --- a/pkg/cloudbroker/extnet/ips_include_range.go +++ b/pkg/cloudbroker/extnet/ips_include_range.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for include range of IPs +// IPsIncludeRangeRequest struct to include range of IPs type IPsIncludeRangeRequest struct { // ID of external network // Required: true @@ -23,13 +23,11 @@ type IPsIncludeRangeRequest struct { IPEnd string `url:"ip_end" json:"ip_end" validate:"required"` } -// IPsIncludeRange include range of IPs to external network pool +// IPsIncludeRange includes range of IPs to external network pool func (e ExtNet) IPsIncludeRange(ctx context.Context, req IPsIncludeRangeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/ipsIncludeRange" diff --git a/pkg/cloudbroker/extnet/ntp_apply.go b/pkg/cloudbroker/extnet/ntp_apply.go index 77b0a97..33de2bc 100644 --- a/pkg/cloudbroker/extnet/ntp_apply.go +++ b/pkg/cloudbroker/extnet/ntp_apply.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set new NTP +// NTPApplyRequest struct for set new NTP type NTPApplyRequest struct { // ID of external network // Required: true @@ -23,9 +23,7 @@ type NTPApplyRequest struct { func (e ExtNet) NTPApply(ctx context.Context, req NTPApplyRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/ntpApply" diff --git a/pkg/cloudbroker/extnet/set_default.go b/pkg/cloudbroker/extnet/set_default.go index ffafdb1..57a4260 100644 --- a/pkg/cloudbroker/extnet/set_default.go +++ b/pkg/cloudbroker/extnet/set_default.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set external network as default +// SetDefaultRequest struct to set external network as default type SetDefaultRequest struct { // ID of external network // Required: true @@ -19,9 +19,7 @@ type SetDefaultRequest struct { func (e ExtNet) SetDefault(ctx context.Context, req SetDefaultRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/setDefault" diff --git a/pkg/cloudbroker/extnet/static_route_access_grant.go b/pkg/cloudbroker/extnet/static_route_access_grant.go index c75a152..b594c4d 100644 --- a/pkg/cloudbroker/extnet/static_route_access_grant.go +++ b/pkg/cloudbroker/extnet/static_route_access_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to static route to Compute/ViNS +// StaticRouteAccessGrantRequest struct to grant access to static route to Compute/ViNS type StaticRouteAccessGrantRequest struct { // ExtNet ID to grant access // Required: true @@ -23,13 +23,11 @@ type StaticRouteAccessGrantRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// Grant access to static route to Compute/ViNS +// StaticRouteAccessGrant grants access to static route to Compute/ViNS func (v ExtNet) StaticRouteAccessGrant(ctx context.Context, req StaticRouteAccessGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/staticRouteAccessGrant" diff --git a/pkg/cloudbroker/extnet/static_route_access_revoke.go b/pkg/cloudbroker/extnet/static_route_access_revoke.go index 91be311..d577cf6 100644 --- a/pkg/cloudbroker/extnet/static_route_access_revoke.go +++ b/pkg/cloudbroker/extnet/static_route_access_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to static route to Compute/ViNS +// StaticRouteAccessRevokeRequest struct to revoke access to static route to Compute/ViNS type StaticRouteAccessRevokeRequest struct { // ExtNet ID to revoke access // Required: true @@ -23,13 +23,11 @@ type StaticRouteAccessRevokeRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// Revoke access to static route to Compute/ViNS +// StaticRouteAccessRevoke revokes access to static route to Compute/ViNS func (v ExtNet) StaticRouteAccessRevoke(ctx context.Context, req StaticRouteAccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/staticRouteAccessRevoke" diff --git a/pkg/cloudbroker/extnet/static_route_add.go b/pkg/cloudbroker/extnet/static_route_add.go index 6f418cc..060e99d 100644 --- a/pkg/cloudbroker/extnet/static_route_add.go +++ b/pkg/cloudbroker/extnet/static_route_add.go @@ -8,11 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add static route +// StaticRouteAddRequest struct to add static route type StaticRouteAddRequest struct { // ExtNet ID to add static route // Required: true - ExtNetId uint64 `url:"extnetId" json:"extnetId" validate:"required"` + ExtNetId uint64 `url:"extnetId" json:"extnetId" validate:"required"` // Destination network // Required: true @@ -31,13 +31,11 @@ type StaticRouteAddRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// StaticRouteAdd add new static route to ViNS +// StaticRouteAdd adds new static route to ViNS func (v ExtNet) StaticRouteAdd(ctx context.Context, req StaticRouteAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/staticRouteAdd" diff --git a/pkg/cloudbroker/extnet/static_route_del.go b/pkg/cloudbroker/extnet/static_route_del.go index f6c49f6..8b8e168 100644 --- a/pkg/cloudbroker/extnet/static_route_del.go +++ b/pkg/cloudbroker/extnet/static_route_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove static route from ViNS +// StaticRouteDelRequest struct to remove static route from ViNS type StaticRouteDelRequest struct { // ExtNet ID to remove static route from // Required: true @@ -19,13 +19,11 @@ type StaticRouteDelRequest struct { RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` } -// Remove static route from ViNS +// StaticRouteDel removes static route from ViNS func (v ExtNet) StaticRouteDel(ctx context.Context, req StaticRouteDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/staticRouteDel" diff --git a/pkg/cloudbroker/extnet/static_route_list.go b/pkg/cloudbroker/extnet/static_route_list.go index 9c411a4..0208062 100644 --- a/pkg/cloudbroker/extnet/static_route_list.go +++ b/pkg/cloudbroker/extnet/static_route_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for static route list +// StaticRouteListRequest struct for static route list type StaticRouteListRequest struct { // ExtNet ID to show list of static routes // Required: true ExtNetID uint64 `url:"extnetId" json:"extnetId" validate:"required"` } -// Show list of static routes for ViNS +// StaticRouteList shows list of static routes for ViNS func (v ExtNet) StaticRouteList(ctx context.Context, req StaticRouteListRequest) (*ListStaticRoutes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/staticRouteList" diff --git a/pkg/cloudbroker/extnet/update.go b/pkg/cloudbroker/extnet/update.go index b189063..e1c7aac 100644 --- a/pkg/cloudbroker/extnet/update.go +++ b/pkg/cloudbroker/extnet/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update external network +// UpdateRequest struct to update external network type UpdateRequest struct { // ID of external network // Required: true @@ -27,9 +27,7 @@ type UpdateRequest struct { func (e ExtNet) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/extnet/update" diff --git a/pkg/cloudbroker/flipgroup/compute_add.go b/pkg/cloudbroker/flipgroup/compute_add.go index fac50d3..8b9858b 100644 --- a/pkg/cloudbroker/flipgroup/compute_add.go +++ b/pkg/cloudbroker/flipgroup/compute_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add compute instance +// ComputeAddRequest struct to add compute instance type ComputeAddRequest struct { // ID of the Floating IP group to add compute instance to // Required: true @@ -19,13 +19,11 @@ type ComputeAddRequest struct { ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// ComputeAdd add compute instance to the Floating IP group +// ComputeAdd adds compute instance to the Floating IP group func (f FLIPGroup) ComputeAdd(ctx context.Context, req ComputeAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/flipgroup/computeAdd" diff --git a/pkg/cloudbroker/flipgroup/compute_remove.go b/pkg/cloudbroker/flipgroup/compute_remove.go index 3c90c35..4a8b4cc 100644 --- a/pkg/cloudbroker/flipgroup/compute_remove.go +++ b/pkg/cloudbroker/flipgroup/compute_remove.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove compute instance +// ComputeRemoveRequest struct to remove compute instance type ComputeRemoveRequest struct { // ID of the Floating IP group to remove compute instance from // Required: true @@ -19,13 +19,11 @@ type ComputeRemoveRequest struct { ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } -// ComputeRemove remove compute instance from the Floating IP group +// ComputeRemove removes compute instance from the Floating IP group func (f FLIPGroup) ComputeRemove(ctx context.Context, req ComputeRemoveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/flipgroup/computeRemove" diff --git a/pkg/cloudbroker/flipgroup/create.go b/pkg/cloudbroker/flipgroup/create.go index 5165a99..f232dab 100644 --- a/pkg/cloudbroker/flipgroup/create.go +++ b/pkg/cloudbroker/flipgroup/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create FLIPGroup +// CreateRequest struct to create FLIPGroup type CreateRequest struct { // Account ID // Required: true @@ -48,9 +48,7 @@ type CreateRequest struct { func (f FLIPGroup) Create(ctx context.Context, req CreateRequest) (*RecordFLIPGroupCreated, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/flipgroup/create" diff --git a/pkg/cloudbroker/flipgroup/delete.go b/pkg/cloudbroker/flipgroup/delete.go index 64b2f94..9184ad1 100644 --- a/pkg/cloudbroker/flipgroup/delete.go +++ b/pkg/cloudbroker/flipgroup/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete FLIPGroup +// DeleteRequest struct to delete FLIPGroup type DeleteRequest struct { // FLIPGroup ID // Required: true @@ -19,9 +19,7 @@ type DeleteRequest struct { func (f FLIPGroup) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/flipgroup/delete" diff --git a/pkg/cloudbroker/flipgroup/edit.go b/pkg/cloudbroker/flipgroup/edit.go index febf21c..14a5c91 100644 --- a/pkg/cloudbroker/flipgroup/edit.go +++ b/pkg/cloudbroker/flipgroup/edit.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for edit FLIPGroup +// EditRequest struct to edit FLIPGroup type EditRequest struct { // FLIPGroup ID // Required: true @@ -27,9 +27,7 @@ type EditRequest struct { func (f FLIPGroup) Edit(ctx context.Context, req EditRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/flipgroup/edit" diff --git a/pkg/cloudbroker/flipgroup/get.go b/pkg/cloudbroker/flipgroup/get.go index e9c6ac1..3c23d56 100644 --- a/pkg/cloudbroker/flipgroup/get.go +++ b/pkg/cloudbroker/flipgroup/get.go @@ -36,9 +36,7 @@ func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, e func (f FLIPGroup) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/flipgroup/get" diff --git a/pkg/cloudbroker/grid/add.go b/pkg/cloudbroker/grid/add.go index dd2c1a1..30c7aa2 100644 --- a/pkg/cloudbroker/grid/add.go +++ b/pkg/cloudbroker/grid/add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for location code +// AddRequest struct for location code type AddRequest struct { // Grid (platform) ID // Required: true @@ -27,9 +27,7 @@ type AddRequest struct { func (g Grid) Add(ctx context.Context, req AddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/add" diff --git a/pkg/cloudbroker/grid/change_settings.go b/pkg/cloudbroker/grid/change_settings.go index c2a762d..734c451 100644 --- a/pkg/cloudbroker/grid/change_settings.go +++ b/pkg/cloudbroker/grid/change_settings.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for change grid settings +// ChangeSettingsRequest struct to change grid settings type ChangeSettingsRequest struct { // Grid (platform) ID // Required: true @@ -23,9 +23,7 @@ type ChangeSettingsRequest struct { func (g Grid) ChangeSettings(ctx context.Context, req ChangeSettingsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/changeSettings" diff --git a/pkg/cloudbroker/grid/check_vms.go b/pkg/cloudbroker/grid/check_vms.go index 82f5190..5e3d89b 100644 --- a/pkg/cloudbroker/grid/check_vms.go +++ b/pkg/cloudbroker/grid/check_vms.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for check virtual machine +// CheckVMsRequest struct to check virtual machine type CheckVMsRequest struct { // Grid (platform) ID // Required: true @@ -19,9 +19,7 @@ type CheckVMsRequest struct { func (g Grid) CheckVMs(ctx context.Context, req CheckVMsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/checkVMs" diff --git a/pkg/cloudbroker/grid/create_system_space.go b/pkg/cloudbroker/grid/create_system_space.go index 663225f..765ac24 100644 --- a/pkg/cloudbroker/grid/create_system_space.go +++ b/pkg/cloudbroker/grid/create_system_space.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create system space +// CreateSystemSpaceRequest struct to create system space type CreateSystemSpaceRequest struct { // Grid (platform) ID // Required: true @@ -46,9 +46,7 @@ type CreateSystemSpaceRequest struct { func (g Grid) CreateSystemSpace(ctx context.Context, req CreateSystemSpaceRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/createSystemSpace" diff --git a/pkg/cloudbroker/grid/execute_maintenance_script.go b/pkg/cloudbroker/grid/execute_maintenance_script.go index d234703..a41a5bf 100644 --- a/pkg/cloudbroker/grid/execute_maintenance_script.go +++ b/pkg/cloudbroker/grid/execute_maintenance_script.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for execute script +// ExecuteMaintenanceScriptRequest struct to execute script type ExecuteMaintenanceScriptRequest struct { // Grid (platform) ID // Required: true @@ -27,9 +27,7 @@ type ExecuteMaintenanceScriptRequest struct { func (g Grid) ExecuteMaintenanceScript(ctx context.Context, req ExecuteMaintenanceScriptRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/executeMaintenanceScript" diff --git a/pkg/cloudbroker/grid/get.go b/pkg/cloudbroker/grid/get.go index b7afd8b..91ad05d 100644 --- a/pkg/cloudbroker/grid/get.go +++ b/pkg/cloudbroker/grid/get.go @@ -36,9 +36,7 @@ func (g Grid) Get(ctx context.Context, req GetRequest) (*RecordGrid, error) { func (g Grid) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/get" diff --git a/pkg/cloudbroker/grid/get_backup.go b/pkg/cloudbroker/grid/get_backup.go index 7f7d0e5..2bd68c3 100644 --- a/pkg/cloudbroker/grid/get_backup.go +++ b/pkg/cloudbroker/grid/get_backup.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get backup +// GetBackupRequest struct to get backup type GetBackupRequest struct { // Grid (platform) ID // Required: true @@ -18,9 +18,7 @@ type GetBackupRequest struct { func (g Grid) GetBackup(ctx context.Context, req GetBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/getBackup" @@ -37,9 +35,7 @@ func (g Grid) GetBackup(ctx context.Context, req GetBackupRequest) (string, erro func (g Grid) GetBackupGET(ctx context.Context, req GetBackupRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/getBackup" diff --git a/pkg/cloudbroker/grid/get_diagnosis.go b/pkg/cloudbroker/grid/get_diagnosis.go index 925c979..f37f1a8 100644 --- a/pkg/cloudbroker/grid/get_diagnosis.go +++ b/pkg/cloudbroker/grid/get_diagnosis.go @@ -7,20 +7,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get platform snapshot with additional diagnosis +// GetDiagnosisRequest struct to get platform snapshot with additional diagnosis type GetDiagnosisRequest struct { // Grid (platform) ID // Required: true GID uint64 `url:"gid" json:"gid" validate:"required"` } -// GetDiagnosis get platform snapshot with additional diagnosis info like a logs, etc +// GetDiagnosis gets platform snapshot with additional diagnosis info like a logs, etc func (g Grid) GetDiagnosis(ctx context.Context, req GetDiagnosisRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/getDiagnosis" @@ -33,13 +31,11 @@ func (g Grid) GetDiagnosis(ctx context.Context, req GetDiagnosisRequest) (string return string(res), nil } -// GetDiagnosisGET get platform snapshot with additional diagnosis info like a logs, etc +// GetDiagnosisGET gets platform snapshot with additional diagnosis info like a logs, etc func (g Grid) GetDiagnosisGET(ctx context.Context, req GetDiagnosisRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/getDiagnosis" diff --git a/pkg/cloudbroker/grid/get_resource_consumption.go b/pkg/cloudbroker/grid/get_resource_consumption.go index afd6c40..cc10439 100644 --- a/pkg/cloudbroker/grid/get_resource_consumption.go +++ b/pkg/cloudbroker/grid/get_resource_consumption.go @@ -8,18 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) +// GetResourceConsumptionRequest struct to get resource consumption type GetResourceConsumptionRequest struct { // ID of the grid // Required: true GridID uint64 `url:"gridId" json:"gridId" validate:"required"` } +// GetResourceConsumption gets resource consumption func (g Grid) GetResourceConsumption(ctx context.Context, req GetResourceConsumptionRequest) (*RecordResourcesConsumption, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/getResourceConsumption" diff --git a/pkg/cloudbroker/grid/list_emails.go b/pkg/cloudbroker/grid/list_emails.go index 71a9151..a1f253b 100644 --- a/pkg/cloudbroker/grid/list_emails.go +++ b/pkg/cloudbroker/grid/list_emails.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for getting list of email addresses of users +// ListEmailsRequest struct for getting list of email addresses of users type ListEmailsRequest struct { // Page number // Required: false @@ -19,7 +19,6 @@ type ListEmailsRequest struct { // ListEmails returns list of email addresses of users func (g Grid) ListEmails(ctx context.Context, req ListEmailsRequest) (*ListEmails, error) { - url := "/cloudbroker/grid/listEmails" res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req) diff --git a/pkg/cloudbroker/grid/purge_logs.go b/pkg/cloudbroker/grid/purge_logs.go index 680f751..e793606 100644 --- a/pkg/cloudbroker/grid/purge_logs.go +++ b/pkg/cloudbroker/grid/purge_logs.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for purge logs +// PurgeLogsRequest struct to purge logs type PurgeLogsRequest struct { // Grid (platform) ID // Required: true @@ -24,9 +24,7 @@ type PurgeLogsRequest struct { func (g Grid) PurgeLogs(ctx context.Context, req PurgeLogsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/purgeLogs" diff --git a/pkg/cloudbroker/grid/rename.go b/pkg/cloudbroker/grid/rename.go index 5728c91..7f886a5 100644 --- a/pkg/cloudbroker/grid/rename.go +++ b/pkg/cloudbroker/grid/rename.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rename grid +// RenameRequest struct to rename grid type RenameRequest struct { // Grid (platform) ID // Required: true @@ -23,9 +23,7 @@ type RenameRequest struct { func (g Grid) Rename(ctx context.Context, req RenameRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/rename" diff --git a/pkg/cloudbroker/grid/services_restart.go b/pkg/cloudbroker/grid/services_restart.go index dc386f6..33175e2 100644 --- a/pkg/cloudbroker/grid/services_restart.go +++ b/pkg/cloudbroker/grid/services_restart.go @@ -8,24 +8,22 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restart services +// ServicesRestartRequest struct to restart services type ServicesRestartRequest struct { // Grid (platform) ID // Required: true - GID uint64 `url:"gid" json:"gid" validate:"required"` + GID uint64 `url:"gid" json:"gid" validate:"required"` // Node ID // Required: true - NID uint64 `url:"nid" json:"nid" validate:"required"` + NID uint64 `url:"nid" json:"nid" validate:"required"` } // ServicesRestart restarts decort services on the node func (g Grid) ServicesRestart(ctx context.Context, req ServicesRestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/servicesRestart" diff --git a/pkg/cloudbroker/grid/set_cpu_allocation_parameter.go b/pkg/cloudbroker/grid/set_cpu_allocation_parameter.go index 6a7b223..10d5d6c 100644 --- a/pkg/cloudbroker/grid/set_cpu_allocation_parameter.go +++ b/pkg/cloudbroker/grid/set_cpu_allocation_parameter.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for setting CPU allocation parameter +// SetCPUAllocationParameterRequest for setting CPU allocation parameter type SetCPUAllocationParameterRequest struct { // Grid ID // Required: true @@ -24,9 +24,7 @@ type SetCPUAllocationParameterRequest struct { func (g Grid) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/setCpuAllocationParameter" diff --git a/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go b/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go index 3ef3e41..fbdc5c8 100644 --- a/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go +++ b/pkg/cloudbroker/grid/set_cpu_allocation_ratio.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set allocation +// SetCPUAllocationRatioRequest struct to set allocation type SetCPUAllocationRatioRequest struct { // Grid (platform) ID // Required: true @@ -23,9 +23,7 @@ type SetCPUAllocationRatioRequest struct { func (g Grid) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/setCpuAllocationRatio" diff --git a/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go b/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go index 5c8fefb..84a7ca3 100644 --- a/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go +++ b/pkg/cloudbroker/grid/set_cpu_allocation_ratio_for_vm.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for setting CPU allocation ratio for computes +// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes type SetCPUAllocationRatioForVMRequest struct { // Grid ID // Required: true @@ -18,13 +18,11 @@ type SetCPUAllocationRatioForVMRequest struct { Ratio float64 `url:"ratio" json:"ratio" validate:"required"` } -// SetCPUAllocationRatio sets CPU allocation ratio for computes +// SetCPUAllocationRatioForVM sets CPU allocation ratio for computes func (g Grid) SetCPUAllocationRatioForVM(ctx context.Context, req SetCPUAllocationRatioForVMRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/setCpuAllocationRatioForVM" diff --git a/pkg/cloudbroker/grid/set_mem_allocation_ratio.go b/pkg/cloudbroker/grid/set_mem_allocation_ratio.go index 0d4ec6e..df15335 100644 --- a/pkg/cloudbroker/grid/set_mem_allocation_ratio.go +++ b/pkg/cloudbroker/grid/set_mem_allocation_ratio.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set memory allocation +// SetMemAllocationRatioRequest struct to set memory allocation type SetMemAllocationRatioRequest struct { // Grid (platform) ID // Required: true @@ -23,9 +23,7 @@ type SetMemAllocationRatioRequest struct { func (g Grid) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/grid/setMemAllocationRatio" diff --git a/pkg/cloudbroker/group/get.go b/pkg/cloudbroker/group/get.go index 5f02a08..8c3c710 100644 --- a/pkg/cloudbroker/group/get.go +++ b/pkg/cloudbroker/group/get.go @@ -36,9 +36,7 @@ func (g Group) Get(ctx context.Context, req GetRequest) (*ItemGroup, error) { func (g Group) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/group/get" diff --git a/pkg/cloudbroker/group/list.go b/pkg/cloudbroker/group/list.go index 2da74b2..6ae1362 100644 --- a/pkg/cloudbroker/group/list.go +++ b/pkg/cloudbroker/group/list.go @@ -4,8 +4,6 @@ import ( "context" "encoding/json" "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // ListRequest struct to get list of group instances. @@ -27,8 +25,8 @@ type ListRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` // Find by active True or False. - // Required: true - Active bool `url:"active" json:"active" validate:"required"` + // Required: false + Active bool `url:"active" json:"active"` } // List gets list of group instances as a ListGroups struct @@ -50,13 +48,6 @@ func (g Group) List(ctx context.Context, req ListRequest) (*ListGroups, error) { // ListRaw gets list of group instances as an array of bytes func (g Group) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) { - err := validators.ValidateRequest(req) - if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } - } - url := "/cloudbroker/group/list" res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req) diff --git a/pkg/cloudbroker/image/computeci_set.go b/pkg/cloudbroker/image/computeci_set.go index c208d9b..b966b1d 100644 --- a/pkg/cloudbroker/image/computeci_set.go +++ b/pkg/cloudbroker/image/computeci_set.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set compute CI +// ComputeCISetRequest struct to set compute CI type ComputeCISetRequest struct { // ID of the image // Required: true @@ -19,13 +19,11 @@ type ComputeCISetRequest struct { ComputeCIID uint64 `url:"computeciId" json:"computeciId" validate:"required"` } -// ComputeCISet set compute CI ID for image +// ComputeCISet sets compute CI ID for image func (i Image) ComputeCISet(ctx context.Context, req ComputeCISetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/computeciSet" diff --git a/pkg/cloudbroker/image/computeci_unset.go b/pkg/cloudbroker/image/computeci_unset.go index 36882ff..3581918 100644 --- a/pkg/cloudbroker/image/computeci_unset.go +++ b/pkg/cloudbroker/image/computeci_unset.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for unset compute CI +// ComputeCIUnsetRequest struct to unset compute CI type ComputeCIUnsetRequest struct { // ID of the image // Required: true ImageID uint64 `url:"imageId" json:"imageId" validate:"required"` } -// ComputeCIUnset unset compute CI ID from image +// ComputeCIUnset unsets compute CI ID from image func (i Image) ComputeCIUnset(ctx context.Context, req ComputeCIUnsetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/сomputeciUnset" diff --git a/pkg/cloudbroker/image/create_cdrom_image.go b/pkg/cloudbroker/image/create_cdrom_image.go index 8438e53..ed1b606 100644 --- a/pkg/cloudbroker/image/create_cdrom_image.go +++ b/pkg/cloudbroker/image/create_cdrom_image.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create CD-ROM image +// CreateCDROMImageRequest struct to create CD-ROM image type CreateCDROMImageRequest struct { // Name of the rescue disk // Required: true @@ -59,9 +59,7 @@ type CreateCDROMImageRequest struct { func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/createCDROMImage" diff --git a/pkg/cloudbroker/image/create_image.go b/pkg/cloudbroker/image/create_image.go index 451175d..5ee9315 100644 --- a/pkg/cloudbroker/image/create_image.go +++ b/pkg/cloudbroker/image/create_image.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create image +// CreateRequest struct to create image type CreateRequest struct { // Name of the rescue disk // Required: true @@ -90,9 +90,7 @@ type CreateRequest struct { func (i Image) CreateImage(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/createImage" diff --git a/pkg/cloudbroker/image/create_virtual.go b/pkg/cloudbroker/image/create_virtual.go index 748869e..df5685a 100644 --- a/pkg/cloudbroker/image/create_virtual.go +++ b/pkg/cloudbroker/image/create_virtual.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create virtual image +// CreateVirtualRequest struct to create virtual image type CreateVirtualRequest struct { // Name of the virtual image to create // Required: true @@ -23,9 +23,7 @@ type CreateVirtualRequest struct { func (i Image) CreateVirtual(ctx context.Context, req CreateVirtualRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/createVirtual" diff --git a/pkg/cloudbroker/image/delete.go b/pkg/cloudbroker/image/delete.go index 4ff7228..0c48e19 100644 --- a/pkg/cloudbroker/image/delete.go +++ b/pkg/cloudbroker/image/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete image +// DeleteRequest struct to delete image type DeleteRequest struct { // ID of the image to delete // Required: true @@ -27,9 +27,7 @@ type DeleteRequest struct { func (i Image) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/delete" diff --git a/pkg/cloudbroker/image/delete_cdrom_image.go b/pkg/cloudbroker/image/delete_cdrom_image.go index ca5a906..904ec82 100644 --- a/pkg/cloudbroker/image/delete_cdrom_image.go +++ b/pkg/cloudbroker/image/delete_cdrom_image.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete CD-ROM image +// DeleteCDROMImageRequest struct to delete CD-ROM image type DeleteCDROMImageRequest struct { // ID of the CD-ROM image to delete // Required: true @@ -19,13 +19,11 @@ type DeleteCDROMImageRequest struct { Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"` } -// DeleteCDROMImage delete a CD-ROM image +// DeleteCDROMImage deletes a CD-ROM image func (i Image) DeleteCDROMImage(ctx context.Context, req DeleteCDROMImageRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/deleteCDROMImage" diff --git a/pkg/cloudbroker/image/delete_images.go b/pkg/cloudbroker/image/delete_images.go index b9e52e3..2ce3dcb 100644 --- a/pkg/cloudbroker/image/delete_images.go +++ b/pkg/cloudbroker/image/delete_images.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete images +// DeleteImagesRequest struct to delete images type DeleteImagesRequest struct { // List of images to be deleted // Required: true @@ -27,9 +27,7 @@ type DeleteImagesRequest struct { func (i Image) DeleteImages(ctx context.Context, req DeleteImagesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/deleteImages" diff --git a/pkg/cloudbroker/image/disable.go b/pkg/cloudbroker/image/disable.go index a3e2aa3..869791d 100644 --- a/pkg/cloudbroker/image/disable.go +++ b/pkg/cloudbroker/image/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable image +// DisableRequest struct to disable image type DisableRequest struct { // ID of image to be disabled // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (i Image) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/disable" diff --git a/pkg/cloudbroker/image/edit.go b/pkg/cloudbroker/image/edit.go index 5526884..f7f0bfc 100644 --- a/pkg/cloudbroker/image/edit.go +++ b/pkg/cloudbroker/image/edit.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for edit image +// EditRequest struct to edit image type EditRequest struct { // ID of the image to edit // Required: true @@ -43,9 +43,7 @@ type EditRequest struct { func (i Image) Edit(ctx context.Context, req EditRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/edit" diff --git a/pkg/cloudbroker/image/enable.go b/pkg/cloudbroker/image/enable.go index 23565ee..c620de5 100644 --- a/pkg/cloudbroker/image/enable.go +++ b/pkg/cloudbroker/image/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable image +// EnableRequest struct to enable image type EnableRequest struct { // ID of image to be enabled // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (i Image) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/enable" diff --git a/pkg/cloudbroker/image/get.go b/pkg/cloudbroker/image/get.go index f0c99b3..7ffee22 100644 --- a/pkg/cloudbroker/image/get.go +++ b/pkg/cloudbroker/image/get.go @@ -36,9 +36,7 @@ func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) { func (i Image) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/get" diff --git a/pkg/cloudbroker/image/link.go b/pkg/cloudbroker/image/link.go index 246fc65..039736a 100644 --- a/pkg/cloudbroker/image/link.go +++ b/pkg/cloudbroker/image/link.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for link virtual image to another image +// LinkRequest struct to link virtual image to another image type LinkRequest struct { // ID of the virtual image // Required: true @@ -23,9 +23,7 @@ type LinkRequest struct { func (i Image) Link(ctx context.Context, req LinkRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/link" diff --git a/pkg/cloudbroker/image/list_stacks.go b/pkg/cloudbroker/image/list_stacks.go index 7808f3e..38b695d 100644 --- a/pkg/cloudbroker/image/list_stacks.go +++ b/pkg/cloudbroker/image/list_stacks.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list stack +// ListStacksRequest struct to get list of stack type ListStacksRequest struct { // Image ID // Required: true @@ -39,9 +39,7 @@ type ListStacksRequest struct { func (i Image) ListStacks(ctx context.Context, req ListStacksRequest) (*ListStacks, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/listStacks" diff --git a/pkg/cloudbroker/image/rename.go b/pkg/cloudbroker/image/rename.go index 49f3824..044e61c 100644 --- a/pkg/cloudbroker/image/rename.go +++ b/pkg/cloudbroker/image/rename.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for rename image +// RenameRequest struct to rename image type RenameRequest struct { // ID of the virtual image to rename // Required: true @@ -23,9 +23,7 @@ type RenameRequest struct { func (i Image) Rename(ctx context.Context, req RenameRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/rename" diff --git a/pkg/cloudbroker/image/share.go b/pkg/cloudbroker/image/share.go index 1c75343..0f7ef20 100644 --- a/pkg/cloudbroker/image/share.go +++ b/pkg/cloudbroker/image/share.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for share image +// ShareRequest struct to share image type ShareRequest struct { // ID of the image to share // Required: true @@ -23,9 +23,7 @@ type ShareRequest struct { func (i Image) Share(ctx context.Context, req ShareRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/share" diff --git a/pkg/cloudbroker/image/sync_create_image.go b/pkg/cloudbroker/image/sync_create_image.go index b093301..0c54a6f 100644 --- a/pkg/cloudbroker/image/sync_create_image.go +++ b/pkg/cloudbroker/image/sync_create_image.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for sync create image +// SyncCreateRequest struct to sync create image type SyncCreateRequest struct { // Name of the rescue disk // Required: true @@ -90,9 +90,7 @@ type SyncCreateRequest struct { func (i Image) SyncCreate(ctx context.Context, req SyncCreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/syncCreateImage" diff --git a/pkg/cloudbroker/image/update_nodes.go b/pkg/cloudbroker/image/update_nodes.go index 7b186e9..3587ca3 100644 --- a/pkg/cloudbroker/image/update_nodes.go +++ b/pkg/cloudbroker/image/update_nodes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update nodes +// UpdateNodesRequest struct to update nodes type UpdateNodesRequest struct { // Image ID // Required: true @@ -19,13 +19,11 @@ type UpdateNodesRequest struct { EnabledStacks []uint64 `url:"enabledStacks,omitempty" json:"enabledStacks,omitempty"` } -// UpdateNodes udates image availability on nodes +// UpdateNodes updates image availability on nodes func (i Image) UpdateNodes(ctx context.Context, req UpdateNodesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/image/updateNodes" diff --git a/pkg/cloudbroker/k8ci/create.go b/pkg/cloudbroker/k8ci/create.go index 4cec30a..2b2d9b2 100644 --- a/pkg/cloudbroker/k8ci/create.go +++ b/pkg/cloudbroker/k8ci/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create K8CI instance +// CreateRequest struct to create K8CI instance type CreateRequest struct { // Name of catalog item // Required: true @@ -69,9 +69,7 @@ type CreateRequest struct { func (k K8CI) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8ci/create" diff --git a/pkg/cloudbroker/k8ci/delete.go b/pkg/cloudbroker/k8ci/delete.go index aa4b21e..f3393bc 100644 --- a/pkg/cloudbroker/k8ci/delete.go +++ b/pkg/cloudbroker/k8ci/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete K8CI +// DeleteRequest struct to delete K8CI type DeleteRequest struct { // K8CI ID // Required: true @@ -23,9 +23,7 @@ type DeleteRequest struct { func (k K8CI) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8ci/delete" diff --git a/pkg/cloudbroker/k8ci/disable.go b/pkg/cloudbroker/k8ci/disable.go index 2b89430..f620784 100644 --- a/pkg/cloudbroker/k8ci/disable.go +++ b/pkg/cloudbroker/k8ci/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable K8CI +// DisableRequest struct to disable K8CI type DisableRequest struct { // K8CI ID // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (k K8CI) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8ci/disable" diff --git a/pkg/cloudbroker/k8ci/enable.go b/pkg/cloudbroker/k8ci/enable.go index 22b75f9..09feaca 100644 --- a/pkg/cloudbroker/k8ci/enable.go +++ b/pkg/cloudbroker/k8ci/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable K8CI +// EnableRequest struct to enable K8CI type EnableRequest struct { // K8CI ID // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (k K8CI) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8ci/enable" diff --git a/pkg/cloudbroker/k8ci/get.go b/pkg/cloudbroker/k8ci/get.go index 76283ee..229739b 100644 --- a/pkg/cloudbroker/k8ci/get.go +++ b/pkg/cloudbroker/k8ci/get.go @@ -36,9 +36,7 @@ func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) { func (k K8CI) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8ci/get" diff --git a/pkg/cloudbroker/k8ci/list_deleted.go b/pkg/cloudbroker/k8ci/list_deleted.go index 83ffda8..a7261ae 100644 --- a/pkg/cloudbroker/k8ci/list_deleted.go +++ b/pkg/cloudbroker/k8ci/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list information about deleted images +// ListDeletedRequest struct to get list information about deleted images type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudbroker/k8ci/restore.go b/pkg/cloudbroker/k8ci/restore.go index a75242b..97e0bc6 100644 --- a/pkg/cloudbroker/k8ci/restore.go +++ b/pkg/cloudbroker/k8ci/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore K8CI +// RestoreRequest struct to restore K8CI type RestoreRequest struct { // K8CI ID // Required: true @@ -19,9 +19,7 @@ type RestoreRequest struct { func (k K8CI) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8ci/restore" diff --git a/pkg/cloudbroker/k8s/create.go b/pkg/cloudbroker/k8s/create.go index 4f1e554..5b02abc 100644 --- a/pkg/cloudbroker/k8s/create.go +++ b/pkg/cloudbroker/k8s/create.go @@ -10,7 +10,7 @@ import ( // type Params []string -// Request struct for create K8S +// CreateRequest struct to create K8S type CreateRequest struct { // Name of kubernetes cluster // Required: true @@ -177,9 +177,7 @@ type CreateRequest struct { func (k K8S) Create(ctx context.Context, req CreateRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } // var params []string diff --git a/pkg/cloudbroker/k8s/delete.go b/pkg/cloudbroker/k8s/delete.go index bbbcce6..af3a2ca 100644 --- a/pkg/cloudbroker/k8s/delete.go +++ b/pkg/cloudbroker/k8s/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete kubernetes cluster +// DeleteRequest struct to delete kubernetes cluster type DeleteRequest struct { // Kubernetes cluster ID // Required: true @@ -24,9 +24,7 @@ type DeleteRequest struct { func (k K8S) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/delete" diff --git a/pkg/cloudbroker/k8s/delete_master_from_group.go b/pkg/cloudbroker/k8s/delete_master_from_group.go index a05ddad..b5a7970 100644 --- a/pkg/cloudbroker/k8s/delete_master_from_group.go +++ b/pkg/cloudbroker/k8s/delete_master_from_group.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete master from group +// DeleteMasterFromGroupRequest struct to delete master from group type DeleteMasterFromGroupRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type DeleteMasterFromGroupRequest struct { func (k K8S) DeleteMasterFromGroup(ctx context.Context, req DeleteMasterFromGroupRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/deleteMasterFromGroup" diff --git a/pkg/cloudbroker/k8s/delete_worker_from_group.go b/pkg/cloudbroker/k8s/delete_worker_from_group.go index 0b72503..46e16f4 100644 --- a/pkg/cloudbroker/k8s/delete_worker_from_group.go +++ b/pkg/cloudbroker/k8s/delete_worker_from_group.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete worker from group +// DeleteWorkerFromGroupRequest struct to delete worker from group type DeleteWorkerFromGroupRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type DeleteWorkerFromGroupRequest struct { func (k K8S) DeleteWorkerFromGroup(ctx context.Context, req DeleteWorkerFromGroupRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/deleteWorkerFromGroup" diff --git a/pkg/cloudbroker/k8s/disable.go b/pkg/cloudbroker/k8s/disable.go index ed931da..fa5fa5c 100644 --- a/pkg/cloudbroker/k8s/disable.go +++ b/pkg/cloudbroker/k8s/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable kubernetes cluster +// DisableRequest struct to disable kubernetes cluster type DisableRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (k K8S) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/disable" diff --git a/pkg/cloudbroker/k8s/enable.go b/pkg/cloudbroker/k8s/enable.go index 7c733a0..b34b43f 100644 --- a/pkg/cloudbroker/k8s/enable.go +++ b/pkg/cloudbroker/k8s/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable kubernetes cluster +// EnableRequest struct to enable kubernetes cluster type EnableRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (k K8S) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/enable" diff --git a/pkg/cloudbroker/k8s/find_group_by_label.go b/pkg/cloudbroker/k8s/find_group_by_label.go index 4905ca9..8a97735 100644 --- a/pkg/cloudbroker/k8s/find_group_by_label.go +++ b/pkg/cloudbroker/k8s/find_group_by_label.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get information about group of kubernetes cluster +// FindGroupByLabelRequest struct for get information about group of kubernetes cluster type FindGroupByLabelRequest struct { // Kubernetes cluster ID // Required: true @@ -24,13 +24,11 @@ type FindGroupByLabelRequest struct { Strict bool `url:"strict,omitempty" json:"strict,omitempty"` } -// FindGroupByLabel find worker group information by one on more labels +// FindGroupByLabel finds worker group information by one on more labels func (k K8S) FindGroupByLabel(ctx context.Context, req FindGroupByLabelRequest) (ListK8SGroup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/findGroupByLabel" diff --git a/pkg/cloudbroker/k8s/get.go b/pkg/cloudbroker/k8s/get.go index b96643a..ac649b0 100644 --- a/pkg/cloudbroker/k8s/get.go +++ b/pkg/cloudbroker/k8s/get.go @@ -36,9 +36,7 @@ func (k K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) { func (k K8S) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/get" diff --git a/pkg/cloudbroker/k8s/get_config.go b/pkg/cloudbroker/k8s/get_config.go index 2929a50..68c1571 100644 --- a/pkg/cloudbroker/k8s/get_config.go +++ b/pkg/cloudbroker/k8s/get_config.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get configuration of kubernetes cluster +// GetConfigRequest struct to get configuration of kubernetes cluster type GetConfigRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type GetConfigRequest struct { func (k K8S) GetConfig(ctx context.Context, req GetConfigRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/getConfig" diff --git a/pkg/cloudbroker/k8s/get_node_annotations.go b/pkg/cloudbroker/k8s/get_node_annotations.go index 738dc3b..4c1cc58 100644 --- a/pkg/cloudbroker/k8s/get_node_annotations.go +++ b/pkg/cloudbroker/k8s/get_node_annotations.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get node annotations +// GetNodeAnnotationsRequest struct to get node annotations type GetNodeAnnotationsRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type GetNodeAnnotationsRequest struct { func (k K8S) GetNodeAnnotations(ctx context.Context, req GetNodeAnnotationsRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/getNodeAnnotations" diff --git a/pkg/cloudbroker/k8s/get_node_labels.go b/pkg/cloudbroker/k8s/get_node_labels.go index 864ac97..22265e0 100644 --- a/pkg/cloudbroker/k8s/get_node_labels.go +++ b/pkg/cloudbroker/k8s/get_node_labels.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get worker node labels +// GetNodeLabelsRequest struct to get worker node labels type GetNodeLabelsRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type GetNodeLabelsRequest struct { func (k K8S) GetNodeLabels(ctx context.Context, req GetNodeLabelsRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/getNodeLabels" diff --git a/pkg/cloudbroker/k8s/get_node_taints.go b/pkg/cloudbroker/k8s/get_node_taints.go index 6bf57f9..b386205 100644 --- a/pkg/cloudbroker/k8s/get_node_taints.go +++ b/pkg/cloudbroker/k8s/get_node_taints.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get node taints +// GetNodeTaintsRequest struct to get node taints type GetNodeTaintsRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type GetNodeTaintsRequest struct { func (k K8S) GetNodeTaints(ctx context.Context, req GetNodeTaintsRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/getNodeTaints" diff --git a/pkg/cloudbroker/k8s/get_worker_nodes_meta_data.go b/pkg/cloudbroker/k8s/get_worker_nodes_meta_data.go index 536d628..6821c8f 100644 --- a/pkg/cloudbroker/k8s/get_worker_nodes_meta_data.go +++ b/pkg/cloudbroker/k8s/get_worker_nodes_meta_data.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get worker group metadata by ID +// GetWorkerNodesMetaDataRequest struct to get worker group metadata by ID type GetWorkerNodesMetaDataRequest struct { // Kubernetes cluster ID // Required: true @@ -18,13 +18,11 @@ type GetWorkerNodesMetaDataRequest struct { WorkersGroupID uint64 `url:"workersGroupId" json:"workersGroupId" validate:"required"` } -// Get worker group metadata by ID +// GetWorkerNodesMetaData gets worker group metadata by ID func (k K8S) GetWorkerNodesMetaData(ctx context.Context, req GetWorkerNodesMetaDataRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/getWorkerNodesMetaData" diff --git a/pkg/cloudbroker/k8s/list_deleted.go b/pkg/cloudbroker/k8s/list_deleted.go index cbaac77..fc72264 100644 --- a/pkg/cloudbroker/k8s/list_deleted.go +++ b/pkg/cloudbroker/k8s/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted kubernetes cluster +// ListDeletedRequest struct to get list of deleted kubernetes cluster type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudbroker/k8s/restore.go b/pkg/cloudbroker/k8s/restore.go index 419041a..22ac768 100644 --- a/pkg/cloudbroker/k8s/restore.go +++ b/pkg/cloudbroker/k8s/restore.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore kubernetes cluster +// RestoreRequest struct to restore kubernetes cluster type RestoreRequest struct { // Kubernetes cluster ID // Required: true K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"` } -// Restore restore kubernetes cluster from recycle bin +// Restore restores kubernetes cluster from recycle bin func (k K8S) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/restore" diff --git a/pkg/cloudbroker/k8s/start.go b/pkg/cloudbroker/k8s/start.go index 8aa2ef5..8cbb13f 100644 --- a/pkg/cloudbroker/k8s/start.go +++ b/pkg/cloudbroker/k8s/start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start kubernetes cluster +// StartRequest struct to start kubernetes cluster type StartRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type StartRequest struct { func (k K8S) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/start" diff --git a/pkg/cloudbroker/k8s/stop.go b/pkg/cloudbroker/k8s/stop.go index d7baa2d..696102f 100644 --- a/pkg/cloudbroker/k8s/stop.go +++ b/pkg/cloudbroker/k8s/stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop kubernetes cluster +// StopRequest struct to stop kubernetes cluster type StopRequest struct { // Kubernetes cluster ID // Required: true @@ -19,9 +19,7 @@ type StopRequest struct { func (k K8S) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/stop" diff --git a/pkg/cloudbroker/k8s/update.go b/pkg/cloudbroker/k8s/update.go index 6f80a3f..bbf3b5a 100644 --- a/pkg/cloudbroker/k8s/update.go +++ b/pkg/cloudbroker/k8s/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update kubernetes cluster +// UpdateRequest struct to update kubernetes cluster type UpdateRequest struct { // Kubernetes cluster ID // Required: true @@ -29,9 +29,7 @@ type UpdateRequest struct { func (k K8S) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/update" diff --git a/pkg/cloudbroker/k8s/update_worker_nodes_meta_data.go b/pkg/cloudbroker/k8s/update_worker_nodes_meta_data.go index cb0e81a..6865a65 100644 --- a/pkg/cloudbroker/k8s/update_worker_nodes_meta_data.go +++ b/pkg/cloudbroker/k8s/update_worker_nodes_meta_data.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add worker to a kubernetes cluster +// UpdateWorkerNodesMetaDataRequest struct to add worker to a kubernetes cluster type UpdateWorkerNodesMetaDataRequest struct { // Kubernetes cluster ID // Required: true @@ -23,13 +23,11 @@ type UpdateWorkerNodesMetaDataRequest struct { UserData string `url:"userData" json:"userData" validate:"required"` } -// WorkerAdd adds worker nodes to a kubernetes cluster +// UpdateWorkerNodesMetaData adds worker nodes to a kubernetes cluster func (k K8S) UpdateWorkerNodesMetaData(ctx context.Context, req UpdateWorkerNodesMetaDataRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/updateWorkerNodesMetaData" diff --git a/pkg/cloudbroker/k8s/worker_add.go b/pkg/cloudbroker/k8s/worker_add.go index f78082c..d92863f 100644 --- a/pkg/cloudbroker/k8s/worker_add.go +++ b/pkg/cloudbroker/k8s/worker_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add worker to a kubernetes cluster +// WorkerAddRequest struct to add worker to a kubernetes cluster type WorkerAddRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type WorkerAddRequest struct { func (k K8S) WorkerAdd(ctx context.Context, req WorkerAddRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/workerAdd" diff --git a/pkg/cloudbroker/k8s/worker_reset.go b/pkg/cloudbroker/k8s/worker_reset.go index e5e3999..50920a3 100644 --- a/pkg/cloudbroker/k8s/worker_reset.go +++ b/pkg/cloudbroker/k8s/worker_reset.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for hard reset kubernetes cluster +// WorkerResetRequest struct for hard reset kubernetes cluster type WorkerResetRequest struct { // Kubernetes cluster ID // Required: true @@ -27,9 +27,7 @@ type WorkerResetRequest struct { func (k K8S) WorkerReset(ctx context.Context, req WorkerResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/workerReset" diff --git a/pkg/cloudbroker/k8s/worker_restart.go b/pkg/cloudbroker/k8s/worker_restart.go index 4cd87b9..ea2beb7 100644 --- a/pkg/cloudbroker/k8s/worker_restart.go +++ b/pkg/cloudbroker/k8s/worker_restart.go @@ -8,11 +8,11 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restart worker node +// WorkerRestartRequest struct to restart worker node type WorkerRestartRequest struct { // Kubernetes cluster ID // Required: true - K8SID uint64 `url:"k8sId" json:"k8sId" validate:"requireD"` + K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"` // ID of the workers compute group // Required: true @@ -27,9 +27,7 @@ type WorkerRestartRequest struct { func (k8s K8S) WorkerRestart(ctx context.Context, req WorkerRestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/workerRestart" diff --git a/pkg/cloudbroker/k8s/workers_group_add.go b/pkg/cloudbroker/k8s/workers_group_add.go index 3f501b9..d9373a9 100644 --- a/pkg/cloudbroker/k8s/workers_group_add.go +++ b/pkg/cloudbroker/k8s/workers_group_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add workers group +// WorkersGroupAddRequest struct to add workers group type WorkersGroupAddRequest struct { // Kubernetes cluster ID // Required: true @@ -68,9 +68,7 @@ type WorkersGroupAddRequest struct { func (k K8S) WorkersGroupAdd(ctx context.Context, req WorkersGroupAddRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/workersGroupAdd" diff --git a/pkg/cloudbroker/k8s/workers_group_delete.go b/pkg/cloudbroker/k8s/workers_group_delete.go index aa90947..3fdc79b 100644 --- a/pkg/cloudbroker/k8s/workers_group_delete.go +++ b/pkg/cloudbroker/k8s/workers_group_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete workers group +// WorkersGroupDeleteRequest struct to delete workers group type WorkersGroupDeleteRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type WorkersGroupDeleteRequest struct { func (k K8S) WorkersGroupDelete(ctx context.Context, req WorkersGroupDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/workersGroupDelete" diff --git a/pkg/cloudbroker/k8s/workers_group_get_by_name.go b/pkg/cloudbroker/k8s/workers_group_get_by_name.go index d2362b9..4d63851 100644 --- a/pkg/cloudbroker/k8s/workers_group_get_by_name.go +++ b/pkg/cloudbroker/k8s/workers_group_get_by_name.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get information about worker group +// WorkersGroupGetByNameRequest struct to get information about worker group type WorkersGroupGetByNameRequest struct { // Kubernetes cluster ID // Required: true @@ -23,9 +23,7 @@ type WorkersGroupGetByNameRequest struct { func (k K8S) WorkersGroupGetByName(ctx context.Context, req WorkersGroupGetByNameRequest) (*RecordK8SGroup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/k8s/workersGroupGetByName" diff --git a/pkg/cloudbroker/kvmppc/create.go b/pkg/cloudbroker/kvmppc/create.go index 083a7d7..9bc0f6d 100644 --- a/pkg/cloudbroker/kvmppc/create.go +++ b/pkg/cloudbroker/kvmppc/create.go @@ -26,7 +26,7 @@ type Interface struct { IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` } -// Request struct for create KVM PowerPC VM +// CreateRequest struct to create KVM PowerPC VM type CreateRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -107,9 +107,7 @@ type wrapperCreateRequest struct { func (k KVMPPC) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudbroker/kvmppc/create_blank.go b/pkg/cloudbroker/kvmppc/create_blank.go index 401cb19..545235e 100644 --- a/pkg/cloudbroker/kvmppc/create_blank.go +++ b/pkg/cloudbroker/kvmppc/create_blank.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create KVM PowerPC VM from scratch +// CreateBlankRequest struct to create KVM PowerPC VM from scratch type CreateBlankRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -61,9 +61,7 @@ type wrapperCreateBlankRequest struct { func (k KVMPPC) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudbroker/kvmppc/mass_create.go b/pkg/cloudbroker/kvmppc/mass_create.go index d3848ca..45ea95b 100644 --- a/pkg/cloudbroker/kvmppc/mass_create.go +++ b/pkg/cloudbroker/kvmppc/mass_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for mass create KVM PowerPC +// MassCreateRequest struct for mass create KVM PowerPC type MassCreateRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -80,9 +80,7 @@ type wrapperMassCreateRequest struct { func (k KVMPPC) MassCreate(ctx context.Context, req MassCreateRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudbroker/kvmx86/create.go b/pkg/cloudbroker/kvmx86/create.go index 9f1b4a7..eb9c8e0 100644 --- a/pkg/cloudbroker/kvmx86/create.go +++ b/pkg/cloudbroker/kvmx86/create.go @@ -26,7 +26,7 @@ type Interface struct { IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"` } -// Request struct for create KVM x86 VM +// CreateRequest struct to create KVM x86 VM type CreateRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -99,7 +99,7 @@ type CreateRequest struct { //Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86) // Required: false - Driver string `url:"driver,omitempty" json:"driver,omitempty"` + Driver string `url:"driver,omitempty" json:"driver,omitempty"` // Reason for action // Required: false @@ -115,9 +115,7 @@ type wrapperCreateRequest struct { func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudbroker/kvmx86/create_blank.go b/pkg/cloudbroker/kvmx86/create_blank.go index acfeb25..4afcfa7 100644 --- a/pkg/cloudbroker/kvmx86/create_blank.go +++ b/pkg/cloudbroker/kvmx86/create_blank.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create KVM x86 VM from scratch +// CreateBlankRequest struct to create KVM x86 VM from scratch type CreateBlankRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -53,7 +53,7 @@ type CreateBlankRequest struct { //Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86) // Required: false - Driver string `url:"driver,omitempty" json:"driver,omitempty"` + Driver string `url:"driver,omitempty" json:"driver,omitempty"` } type wrapperCreateBlankRequest struct { @@ -65,9 +65,7 @@ type wrapperCreateBlankRequest struct { func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudbroker/kvmx86/mass_create.go b/pkg/cloudbroker/kvmx86/mass_create.go index d8768a8..17390a4 100644 --- a/pkg/cloudbroker/kvmx86/mass_create.go +++ b/pkg/cloudbroker/kvmx86/mass_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for mass create KVM x86 +// MassCreateRequest struct to mass create KVM x86 type MassCreateRequest struct { // ID of the resource group, which will own this VM // Required: true @@ -80,9 +80,7 @@ type wrapperMassCreateRequest struct { func (k KVMX86) MassCreate(ctx context.Context, req MassCreateRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } var interfaces []string diff --git a/pkg/cloudbroker/lb/backend_create.go b/pkg/cloudbroker/lb/backend_create.go index 2c8c2b4..c479880 100644 --- a/pkg/cloudbroker/lb/backend_create.go +++ b/pkg/cloudbroker/lb/backend_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create backend +// BackendCreateRequest struct to create backend type BackendCreateRequest struct { // ID of the load balancer instance to backendCreate // Required: true @@ -67,13 +67,11 @@ type BackendCreateRequest struct { Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"` } -// BackendCreate creates new backend on the specified load balancer +// BackendCreate creates new backend on the specified load balancer func (lb LB) BackendCreate(ctx context.Context, req BackendCreateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/backendCreate" diff --git a/pkg/cloudbroker/lb/backend_delete.go b/pkg/cloudbroker/lb/backend_delete.go index 0009168..65d8e7b 100644 --- a/pkg/cloudbroker/lb/backend_delete.go +++ b/pkg/cloudbroker/lb/backend_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete backend +// BackendDeleteRequest struct to delete backend type BackendDeleteRequest struct { // ID of the load balancer instance to BackendDelete // Required: true @@ -24,9 +24,7 @@ type BackendDeleteRequest struct { func (lb LB) BackendDelete(ctx context.Context, req BackendDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/backendDelete" diff --git a/pkg/cloudbroker/lb/backend_server_add.go b/pkg/cloudbroker/lb/backend_server_add.go index b856394..c653b74 100644 --- a/pkg/cloudbroker/lb/backend_server_add.go +++ b/pkg/cloudbroker/lb/backend_server_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add server definition to the backend +// BackendServerAddRequest struct to add server definition to the backend type BackendServerAddRequest struct { // ID of the load balancer instance to BackendServerAdd // Required: true @@ -76,9 +76,7 @@ type BackendServerAddRequest struct { func (lb LB) BackendServerAdd(ctx context.Context, req BackendServerAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/backendServerAdd" diff --git a/pkg/cloudbroker/lb/backend_server_delete.go b/pkg/cloudbroker/lb/backend_server_delete.go index f6fafe3..b152273 100644 --- a/pkg/cloudbroker/lb/backend_server_delete.go +++ b/pkg/cloudbroker/lb/backend_server_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete server definition +// BackendServerDeleteRequest struct to delete server definition type BackendServerDeleteRequest struct { // ID of the load balancer instance to BackendServerDelete // Required: true @@ -28,9 +28,7 @@ type BackendServerDeleteRequest struct { func (lb LB) BackendServerDelete(ctx context.Context, req BackendServerDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/backendServerDelete" diff --git a/pkg/cloudbroker/lb/backend_server_update.go b/pkg/cloudbroker/lb/backend_server_update.go index 5a9bd77..0cd9504 100644 --- a/pkg/cloudbroker/lb/backend_server_update.go +++ b/pkg/cloudbroker/lb/backend_server_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update server +// BackendServerUpdateRequest struct to update server type BackendServerUpdateRequest struct { // ID of the load balancer instance to BackendServerAdd // Required: true @@ -76,9 +76,7 @@ type BackendServerUpdateRequest struct { func (lb LB) BackendServerUpdate(ctx context.Context, req BackendServerUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/backendServerUpdate" diff --git a/pkg/cloudbroker/lb/backend_update.go b/pkg/cloudbroker/lb/backend_update.go index 55fbde8..29351a3 100644 --- a/pkg/cloudbroker/lb/backend_update.go +++ b/pkg/cloudbroker/lb/backend_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update backend +// BackendUpdateRequest struct to update backend type BackendUpdateRequest struct { // ID of the load balancer instance to backendCreate // Required: true @@ -71,9 +71,7 @@ type BackendUpdateRequest struct { func (lb LB) BackendUpdate(ctx context.Context, req BackendUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/backendUpdate" diff --git a/pkg/cloudbroker/lb/config_reset.go b/pkg/cloudbroker/lb/config_reset.go index 4819e22..c40fe67 100644 --- a/pkg/cloudbroker/lb/config_reset.go +++ b/pkg/cloudbroker/lb/config_reset.go @@ -8,21 +8,19 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reset config +// ConfigResetRequest struct to reset config type ConfigResetRequest struct { // ID of the load balancer instance to ConfigReset // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` } -// ConfigReset reset current software configuration of the specified load balancer. +// ConfigReset resets current software configuration of the specified load balancer. // Warning: this action cannot be undone! func (lb LB) ConfigReset(ctx context.Context, req ConfigResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/configReset" diff --git a/pkg/cloudbroker/lb/create.go b/pkg/cloudbroker/lb/create.go index df30ec2..79bb4c5 100644 --- a/pkg/cloudbroker/lb/create.go +++ b/pkg/cloudbroker/lb/create.go @@ -12,7 +12,7 @@ import ( type Params []string -// Request struct for create load balancer +// CreateRequest struct to create load balancer type CreateRequest struct { // ID of the resource group where this load balancer instance will be located // Required: true @@ -57,9 +57,7 @@ type wrapperCreateRequest struct { func (lb LB) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } if req.ExtNetID == 0 && req.VINSID == 0 { diff --git a/pkg/cloudbroker/lb/delete.go b/pkg/cloudbroker/lb/delete.go index f2704af..1868793 100644 --- a/pkg/cloudbroker/lb/delete.go +++ b/pkg/cloudbroker/lb/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete load balancer +// DeleteRequest struct to delete load balancer type DeleteRequest struct { // ID of the load balancer instance to delete // Required: true @@ -23,9 +23,7 @@ type DeleteRequest struct { func (lb LB) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/delete" diff --git a/pkg/cloudbroker/lb/disable.go b/pkg/cloudbroker/lb/disable.go index f241fa6..c4eb10d 100644 --- a/pkg/cloudbroker/lb/disable.go +++ b/pkg/cloudbroker/lb/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable load balancer +// DisableRequest struct to disable load balancer type DisableRequest struct { // ID of the load balancer instance to disable // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (lb LB) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/disable" diff --git a/pkg/cloudbroker/lb/enable.go b/pkg/cloudbroker/lb/enable.go index c5781e8..5163cc5 100644 --- a/pkg/cloudbroker/lb/enable.go +++ b/pkg/cloudbroker/lb/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable load balancer +// EnableRequest struct to enable load balancer type EnableRequest struct { // ID of the load balancer instance to enable // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (lb LB) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/enable" diff --git a/pkg/cloudbroker/lb/frontend_bind.go b/pkg/cloudbroker/lb/frontend_bind.go index 5ee7b48..3f05461 100644 --- a/pkg/cloudbroker/lb/frontend_bind.go +++ b/pkg/cloudbroker/lb/frontend_bind.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for frontend bind +// FrontendBindRequest struct for frontend bind type FrontendBindRequest struct { // ID of the load balancer instance to FrontendBind // Required: true @@ -38,9 +38,7 @@ type FrontendBindRequest struct { func (lb LB) FrontendBind(ctx context.Context, req FrontendBindRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/frontendBind" diff --git a/pkg/cloudbroker/lb/frontend_bind_delete.go b/pkg/cloudbroker/lb/frontend_bind_delete.go index fc9e8bd..ef5b586 100644 --- a/pkg/cloudbroker/lb/frontend_bind_delete.go +++ b/pkg/cloudbroker/lb/frontend_bind_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete bind +// FrontendBindDeleteRequest struct to delete bind type FrontendBindDeleteRequest struct { // ID of the load balancer instance to FrontendBindDelete // Required: true @@ -27,9 +27,7 @@ type FrontendBindDeleteRequest struct { func (lb LB) FrontendBindDelete(ctx context.Context, req FrontendBindDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/frontendBindDelete" diff --git a/pkg/cloudbroker/lb/frontend_binding_update.go b/pkg/cloudbroker/lb/frontend_binding_update.go index 1ce9a76..4c3e5b8 100644 --- a/pkg/cloudbroker/lb/frontend_binding_update.go +++ b/pkg/cloudbroker/lb/frontend_binding_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update binding +// FrontendBindUpdateRequest struct for update binding type FrontendBindUpdateRequest struct { // ID of the load balancer instance to FrontendBindUpdate // Required: true @@ -38,9 +38,7 @@ type FrontendBindUpdateRequest struct { func (lb LB) FrontendBindUpdate(ctx context.Context, req FrontendBindUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/frontendBindingUpdate" diff --git a/pkg/cloudbroker/lb/frontend_create.go b/pkg/cloudbroker/lb/frontend_create.go index dfcb3b3..5ed0348 100644 --- a/pkg/cloudbroker/lb/frontend_create.go +++ b/pkg/cloudbroker/lb/frontend_create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create frontend +// FrontendCreateRequest struct for create frontend type FrontendCreateRequest struct { // ID of the load balancer instance to FrontendCreate // Required: true @@ -29,9 +29,7 @@ type FrontendCreateRequest struct { func (l LB) FrontendCreate(ctx context.Context, req FrontendCreateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/frontendCreate" diff --git a/pkg/cloudbroker/lb/frontend_delete.go b/pkg/cloudbroker/lb/frontend_delete.go index d9e28d0..1244eee 100644 --- a/pkg/cloudbroker/lb/frontend_delete.go +++ b/pkg/cloudbroker/lb/frontend_delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete frontend +// FrontendDeleteRequest struct for delete frontend type FrontendDeleteRequest struct { // ID of the load balancer instance to FrontendDelete // Required: true @@ -24,9 +24,7 @@ type FrontendDeleteRequest struct { func (lb LB) FrontendDelete(ctx context.Context, req FrontendDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/frontendDelete" diff --git a/pkg/cloudbroker/lb/get.go b/pkg/cloudbroker/lb/get.go index 9541b92..7609903 100644 --- a/pkg/cloudbroker/lb/get.go +++ b/pkg/cloudbroker/lb/get.go @@ -36,9 +36,7 @@ func (lb LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) { func (lb LB) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/get" diff --git a/pkg/cloudbroker/lb/list_deleted.go b/pkg/cloudbroker/lb/list_deleted.go index 4af9323..d698226 100644 --- a/pkg/cloudbroker/lb/list_deleted.go +++ b/pkg/cloudbroker/lb/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list of deleted load balancers +// ListDeletedRequest struct to get list of deleted load balancers type ListDeletedRequest struct { // Find by ID // Required: false @@ -62,5 +62,4 @@ func (lb LB) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListLB, } return &list, nil - } diff --git a/pkg/cloudbroker/lb/make_highly_available.go b/pkg/cloudbroker/lb/make_highly_available.go index ab3e08f..e10463b 100644 --- a/pkg/cloudbroker/lb/make_highly_available.go +++ b/pkg/cloudbroker/lb/make_highly_available.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for make Load Balancer Highly available +// HighlyAvailableRequest struct to make Load Balancer Highly available type HighlyAvailableRequest struct { // ID of the LB instance // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` } -// Make Load Balancer Highly available +// HighlyAvailable makes Load Balancer Highly available func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/makeHighlyAvailable" diff --git a/pkg/cloudbroker/lb/restart.go b/pkg/cloudbroker/lb/restart.go index f2d1dd9..1da718a 100644 --- a/pkg/cloudbroker/lb/restart.go +++ b/pkg/cloudbroker/lb/restart.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restart load balancer +// RestartRequest struct to restart load balancer type RestartRequest struct { // ID of the load balancer instance to restart // Required: true @@ -19,9 +19,7 @@ type RestartRequest struct { func (lb LB) Restart(ctx context.Context, req RestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/restart" diff --git a/pkg/cloudbroker/lb/restore.go b/pkg/cloudbroker/lb/restore.go index 2e5c80d..e73973a 100644 --- a/pkg/cloudbroker/lb/restore.go +++ b/pkg/cloudbroker/lb/restore.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore load balancer +// RestoreRequest struct to restore load balancer type RestoreRequest struct { // ID of the load balancer instance to restore // Required: true LBID uint64 `url:"lbId" json:"lbId" validate:"required"` } -// Restore restore load balancer from recycle bin +// Restore restores load balancer from recycle bin func (lb LB) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/restore" diff --git a/pkg/cloudbroker/lb/start.go b/pkg/cloudbroker/lb/start.go index 9a79c94..a35bb25 100644 --- a/pkg/cloudbroker/lb/start.go +++ b/pkg/cloudbroker/lb/start.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start load balancer +// StartRequest struct to start load balancer type StartRequest struct { // ID of the LB instance to start // Required: true - LBID uint64 `url:"lbId" json:"lbId" validate:"required"` + LBID uint64 `url:"lbId" json:"lbId" validate:"required"` } // Start starts specified load balancer instance func (lb LB) Start(ctx context.Context, req StartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/start" diff --git a/pkg/cloudbroker/lb/stop.go b/pkg/cloudbroker/lb/stop.go index 5251937..2e8d380 100644 --- a/pkg/cloudbroker/lb/stop.go +++ b/pkg/cloudbroker/lb/stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop load balancer +// StopRequest struct to stop load balancer type StopRequest struct { // ID of the LB instance to stop // Required: true @@ -19,9 +19,7 @@ type StopRequest struct { func (lb LB) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/stop" diff --git a/pkg/cloudbroker/lb/update.go b/pkg/cloudbroker/lb/update.go index b72ad88..b2a6fa0 100644 --- a/pkg/cloudbroker/lb/update.go +++ b/pkg/cloudbroker/lb/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update load balancer +// UpdateRequest struct to update load balancer type UpdateRequest struct { // ID of the load balancer to update // Required: true @@ -24,9 +24,7 @@ type UpdateRequest struct { func (lb LB) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/lb/update" diff --git a/pkg/cloudbroker/lb/updateSysctParams.go b/pkg/cloudbroker/lb/updateSysctParams.go index 018f5e8..351b89d 100644 --- a/pkg/cloudbroker/lb/updateSysctParams.go +++ b/pkg/cloudbroker/lb/updateSysctParams.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update sysct params for lb +// UpdateSysctParamsRequest struct to update sysct params for lb type UpdateSysctParamsRequest struct { // ID of the LB instance // Required: true @@ -25,13 +25,11 @@ type wrapperUpdateSysctParamsRequest struct { Params []string `url:"sysctlParams" validate:"required"` } -// Create method will create a new load balancer instance +// UpdateSysctParams method will create a new load balancer instance func (l LB) UpdateSysctParams(ctx context.Context, req UpdateSysctParamsRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } var params []string diff --git a/pkg/cloudbroker/pcidevice/create.go b/pkg/cloudbroker/pcidevice/create.go index ab00e77..f376d83 100644 --- a/pkg/cloudbroker/pcidevice/create.go +++ b/pkg/cloudbroker/pcidevice/create.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request struct for creating PCI device +// CreateRequest struct to creating PCI device type CreateRequest struct { // StackID // Required: true @@ -35,9 +35,7 @@ type CreateRequest struct { func (p PCIDevice) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/pcidevice/create" diff --git a/pkg/cloudbroker/pcidevice/delete.go b/pkg/cloudbroker/pcidevice/delete.go index 730acba..3d3976e 100644 --- a/pkg/cloudbroker/pcidevice/delete.go +++ b/pkg/cloudbroker/pcidevice/delete.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request struct for deleting PCI device +// DeleteRequest struct to deleting PCI device type DeleteRequest struct { // PCI device ID // Required: true @@ -18,13 +18,11 @@ type DeleteRequest struct { Force bool `url:"force,omitempty" json:"force,omitempty"` } -// Delete PCI device +// Delete deletes PCI device func (p PCIDevice) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/pcidevice/delete" diff --git a/pkg/cloudbroker/pcidevice/disable.go b/pkg/cloudbroker/pcidevice/disable.go index dd35ff1..6aa3808 100644 --- a/pkg/cloudbroker/pcidevice/disable.go +++ b/pkg/cloudbroker/pcidevice/disable.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request struct for disabling PCI device +// DisableRequest struct for disabling PCI device type DisableRequest struct { // PCI device ID // Required: true @@ -18,13 +18,11 @@ type DisableRequest struct { Force bool `url:"force,omitempty" json:"force,omitempty"` } -// Disable PCI device +// Disable disables PCI device func (p PCIDevice) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/pcidevice/disable" diff --git a/pkg/cloudbroker/pcidevice/enable.go b/pkg/cloudbroker/pcidevice/enable.go index e2c36f8..b6be041 100644 --- a/pkg/cloudbroker/pcidevice/enable.go +++ b/pkg/cloudbroker/pcidevice/enable.go @@ -7,20 +7,18 @@ import ( "strconv" ) -// Request struct for enabling PCI device +// EnableRequest struct for enabling PCI device type EnableRequest struct { // PCI device ID // Required: true DeviceID uint64 `url:"deviceId" json:"deviceId" validate:"required"` } -// Enable PCI device +// Enable enables PCI device func (p PCIDevice) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/pcidevice/enable" diff --git a/pkg/cloudbroker/rg/access_grant.go b/pkg/cloudbroker/rg/access_grant.go index 6e90dbe..bba0605 100644 --- a/pkg/cloudbroker/rg/access_grant.go +++ b/pkg/cloudbroker/rg/access_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to resource group +// AccessGrantRequest struct to grant access to resource group type AccessGrantRequest struct { // Resource group ID // Required: true @@ -35,9 +35,7 @@ type AccessGrantRequest struct { func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/accessGrant" diff --git a/pkg/cloudbroker/rg/access_revoke.go b/pkg/cloudbroker/rg/access_revoke.go index e6a8e45..7e63e18 100644 --- a/pkg/cloudbroker/rg/access_revoke.go +++ b/pkg/cloudbroker/rg/access_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access +// AccessRevokeRequest struct to revoke access type AccessRevokeRequest struct { // Resource group ID // Required: true @@ -27,9 +27,7 @@ type AccessRevokeRequest struct { func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/accessRevoke" diff --git a/pkg/cloudbroker/rg/affinity_group_computes.go b/pkg/cloudbroker/rg/affinity_group_computes.go index cd4601f..16060e4 100644 --- a/pkg/cloudbroker/rg/affinity_group_computes.go +++ b/pkg/cloudbroker/rg/affinity_group_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of all computes with their relationships +// AffinityGroupComputesRequest struct to get list of all computes with their relationships type AffinityGroupComputesRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type AffinityGroupComputesRequest struct { func (r RG) AffinityGroupComputes(ctx context.Context, req AffinityGroupComputesRequest) (ListAffinityGroupCompute, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/affinityGroupComputes" diff --git a/pkg/cloudbroker/rg/affinity_groups_get.go b/pkg/cloudbroker/rg/affinity_groups_get.go index ea181b9..8f7731f 100644 --- a/pkg/cloudbroker/rg/affinity_groups_get.go +++ b/pkg/cloudbroker/rg/affinity_groups_get.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list computes from affinity group +// AffinityGroupsGetRequest struct to get list of computes from affinity group type AffinityGroupsGetRequest struct { // Resource group ID // Required: true @@ -19,13 +19,11 @@ type AffinityGroupsGetRequest struct { AffinityGroup string `url:"affinityGroup" json:"affinityGroup" validate:"required"` } -// AffinityGroupsGet gets list computes in the specified affinity group +// AffinityGroupsGet gets list of computes in the specified affinity group func (r RG) AffinityGroupsGet(ctx context.Context, req AffinityGroupsGetRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/affinityGroupsGet" diff --git a/pkg/cloudbroker/rg/affinity_groups_list.go b/pkg/cloudbroker/rg/affinity_groups_list.go index 2bd0ac7..a2e2555 100644 --- a/pkg/cloudbroker/rg/affinity_groups_list.go +++ b/pkg/cloudbroker/rg/affinity_groups_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of affinity groups from resource group +// AffinityGroupsListRequest struct to get list of affinity groups from resource group type AffinityGroupsListRequest struct { // Resource group ID // Required: true @@ -19,9 +19,7 @@ type AffinityGroupsListRequest struct { func (r RG) AffinityGroupsList(ctx context.Context, req AffinityGroupsListRequest) (*ListAffinityGroup, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/affinityGroupsList" diff --git a/pkg/cloudbroker/rg/audits.go b/pkg/cloudbroker/rg/audits.go index 59bda95..20403cd 100644 --- a/pkg/cloudbroker/rg/audits.go +++ b/pkg/cloudbroker/rg/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get audit +// AuditsRequest struct to get audit type AuditsRequest struct { // Resource group ID // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (r RG) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/audits" diff --git a/pkg/cloudbroker/rg/create.go b/pkg/cloudbroker/rg/create.go index 29dddaa..2f40ff0 100644 --- a/pkg/cloudbroker/rg/create.go +++ b/pkg/cloudbroker/rg/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create resource group +// CreateRequest struct to create resource group type CreateRequest struct { // Account, which will own this resource group // Required: true @@ -89,9 +89,7 @@ type CreateRequest struct { func (r RG) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/create" diff --git a/pkg/cloudbroker/rg/delete.go b/pkg/cloudbroker/rg/delete.go index 31813dd..725846f 100644 --- a/pkg/cloudbroker/rg/delete.go +++ b/pkg/cloudbroker/rg/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete resource group +// DeleteRequest struct to delete resource group type DeleteRequest struct { // Resource group ID // Required: true @@ -32,9 +32,7 @@ type DeleteRequest struct { func (r RG) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/delete" diff --git a/pkg/cloudbroker/rg/disable.go b/pkg/cloudbroker/rg/disable.go index 56d7b9f..5b39c3e 100644 --- a/pkg/cloudbroker/rg/disable.go +++ b/pkg/cloudbroker/rg/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable resource group +// DisableRequest struct to disable resource group type DisableRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type DisableRequest struct { func (r RG) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/disable" diff --git a/pkg/cloudbroker/rg/enable.go b/pkg/cloudbroker/rg/enable.go index 7a4b03f..0dde32c 100644 --- a/pkg/cloudbroker/rg/enable.go +++ b/pkg/cloudbroker/rg/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable resource group +// EnableRequest struct to enable resource group type EnableRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type EnableRequest struct { func (r RG) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/enable" diff --git a/pkg/cloudbroker/rg/get.go b/pkg/cloudbroker/rg/get.go index f41fbff..01de709 100644 --- a/pkg/cloudbroker/rg/get.go +++ b/pkg/cloudbroker/rg/get.go @@ -40,9 +40,7 @@ func (r RG) Get(ctx context.Context, req GetRequest) (*RecordRG, error) { func (r RG) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/get" diff --git a/pkg/cloudbroker/rg/get_resource_consumption.go b/pkg/cloudbroker/rg/get_resource_consumption.go index fd26aa2..cef0c42 100644 --- a/pkg/cloudbroker/rg/get_resource_consumption.go +++ b/pkg/cloudbroker/rg/get_resource_consumption.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get detailed information about resource consumption for ResGroup +// GetResourceConsumptionRequest struct to get detailed information about resource consumption for ResGroup type GetResourceConsumptionRequest struct { // Resource group ID // Required: true @@ -19,9 +19,7 @@ type GetResourceConsumptionRequest struct { func (r RG) GetResourceConsumption(ctx context.Context, req GetResourceConsumptionRequest) (*ItemResourceConsumption, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/getResourceConsumption" diff --git a/pkg/cloudbroker/rg/list_computes.go b/pkg/cloudbroker/rg/list_computes.go index 7a55288..d76c406 100644 --- a/pkg/cloudbroker/rg/list_computes.go +++ b/pkg/cloudbroker/rg/list_computes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of computes +// ListComputesRequest struct to get list of computes type ListComputesRequest struct { // Resource group ID // Required: true @@ -59,9 +59,7 @@ type ListComputesRequest struct { func (r RG) ListComputes(ctx context.Context, req ListComputesRequest) (*ListComputes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/listComputes" diff --git a/pkg/cloudbroker/rg/list_deleted.go b/pkg/cloudbroker/rg/list_deleted.go index d5e54ea..8fb5884 100644 --- a/pkg/cloudbroker/rg/list_deleted.go +++ b/pkg/cloudbroker/rg/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list deleted resource groups +// ListDeletedRequest struct to get list of deleted resource groups type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudbroker/rg/list_lb.go b/pkg/cloudbroker/rg/list_lb.go index 0183e1d..d4e1c20 100644 --- a/pkg/cloudbroker/rg/list_lb.go +++ b/pkg/cloudbroker/rg/list_lb.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list load balancers +// ListLBRequest struct to get list of load balancers type ListLBRequest struct { // Resource group ID // Required: true @@ -51,13 +51,11 @@ type ListLBRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListLB gets list all load balancers in the specified resource group, accessible by the user +// ListLB gets list of all load balancers in the specified resource group, accessible by the user func (r RG) ListLB(ctx context.Context, req ListLBRequest) (*ListLB, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/listLb" diff --git a/pkg/cloudbroker/rg/list_pfw.go b/pkg/cloudbroker/rg/list_pfw.go index c98370f..4340b91 100644 --- a/pkg/cloudbroker/rg/list_pfw.go +++ b/pkg/cloudbroker/rg/list_pfw.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list port forward rules +// ListPFWRequest struct to get list of port forward rules type ListPFWRequest struct { // Resource group ID // Required: true RGID uint64 `url:"rgId" json:"rgId" validate:"required"` } -// ListPFW gets list port forward rules for the specified resource group +// ListPFW gets list of port forward rules for the specified resource group func (r RG) ListPFW(ctx context.Context, req ListPFWRequest) (*ListPFW, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/listPFW" diff --git a/pkg/cloudbroker/rg/list_vins.go b/pkg/cloudbroker/rg/list_vins.go index 7980d6a..c4c8119 100644 --- a/pkg/cloudbroker/rg/list_vins.go +++ b/pkg/cloudbroker/rg/list_vins.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list VINSes +// ListVINSRequest struct to get list of VINSes type ListVINSRequest struct { // Resource group ID // Required: true @@ -39,13 +39,11 @@ type ListVINSRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// ListVINS gets list all ViNSes under specified resource group, accessible by the user +// ListVINS gets list of all ViNSes under specified resource group, accessible by the user func (r RG) ListVINS(ctx context.Context, req ListVINSRequest) (*ListVINS, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/listVins" diff --git a/pkg/cloudbroker/rg/mass_delete.go b/pkg/cloudbroker/rg/mass_delete.go index 8b17d65..a6f42fd 100644 --- a/pkg/cloudbroker/rg/mass_delete.go +++ b/pkg/cloudbroker/rg/mass_delete.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete several resource groups +// MassDeleteRequest struct to delete several resource groups type MassDeleteRequest struct { // IDs of the resource groups // Required: true @@ -33,9 +33,7 @@ type MassDeleteRequest struct { func (r RG) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/massDelete" diff --git a/pkg/cloudbroker/rg/mass_disable.go b/pkg/cloudbroker/rg/mass_disable.go index b7c11f7..c51d4a4 100644 --- a/pkg/cloudbroker/rg/mass_disable.go +++ b/pkg/cloudbroker/rg/mass_disable.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable several resource groups +// MassDisableRequest struct to disable several resource groups type MassDisableRequest struct { // IDs of the resource groups // Required: true @@ -22,9 +22,7 @@ type MassDisableRequest struct { func (r RG) MassDisable(ctx context.Context, req MassDisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/massDisable" diff --git a/pkg/cloudbroker/rg/mass_enable.go b/pkg/cloudbroker/rg/mass_enable.go index 42f677d..bd8080d 100644 --- a/pkg/cloudbroker/rg/mass_enable.go +++ b/pkg/cloudbroker/rg/mass_enable.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable several resource groups +// MassEnableRequest struct to enable several resource groups type MassEnableRequest struct { // IDs of the resource groups // Required: true @@ -22,9 +22,7 @@ type MassEnableRequest struct { func (r RG) MassEnable(ctx context.Context, req MassEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/massEnable" diff --git a/pkg/cloudbroker/rg/restore.go b/pkg/cloudbroker/rg/restore.go index bb0aedc..81dc927 100644 --- a/pkg/cloudbroker/rg/restore.go +++ b/pkg/cloudbroker/rg/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore resource group +// RestoreRequest struct to restore resource group type RestoreRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type RestoreRequest struct { func (r RG) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/restore" diff --git a/pkg/cloudbroker/rg/set_cpu_allocation_parameter.go b/pkg/cloudbroker/rg/set_cpu_allocation_parameter.go index 4bc802c..f41b84c 100644 --- a/pkg/cloudbroker/rg/set_cpu_allocation_parameter.go +++ b/pkg/cloudbroker/rg/set_cpu_allocation_parameter.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for setting CPU allocation parameter +// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter type SetCPUAllocationParameterRequest struct { // Resource group ID // Required: true @@ -24,9 +24,7 @@ type SetCPUAllocationParameterRequest struct { func (r RG) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/setCpuAllocationParameter" diff --git a/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go b/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go index 6246a8a..48473b2 100644 --- a/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go +++ b/pkg/cloudbroker/rg/set_cpu_allocation_ratio.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for setting CPU allocation ratio +// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio type SetCPUAllocationRatioRequest struct { // Resource group ID // Required: true @@ -22,9 +22,7 @@ type SetCPUAllocationRatioRequest struct { func (r RG) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/setCpuAllocationRatio" diff --git a/pkg/cloudbroker/rg/set_def_net.go b/pkg/cloudbroker/rg/set_def_net.go index 2820222..0a1f720 100644 --- a/pkg/cloudbroker/rg/set_def_net.go +++ b/pkg/cloudbroker/rg/set_def_net.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for set default network +// SetDefNetRequest struct to set default network type SetDefNetRequest struct { // Resource group ID // Required: true @@ -34,9 +34,7 @@ type SetDefNetRequest struct { func (r RG) SetDefNet(ctx context.Context, req SetDefNetRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/setDefNet" diff --git a/pkg/cloudbroker/rg/update.go b/pkg/cloudbroker/rg/update.go index a7772be..488a1e5 100644 --- a/pkg/cloudbroker/rg/update.go +++ b/pkg/cloudbroker/rg/update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update resource group +// UpdateRequest struct to update resource group type UpdateRequest struct { // Resource group ID // Required: true @@ -59,9 +59,7 @@ type UpdateRequest struct { func (r RG) Update(ctx context.Context, req UpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/update" diff --git a/pkg/cloudbroker/rg/update_resource_types.go b/pkg/cloudbroker/rg/update_resource_types.go index 988595b..1d69719 100644 --- a/pkg/cloudbroker/rg/update_resource_types.go +++ b/pkg/cloudbroker/rg/update_resource_types.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update resource types in account +// UpdateResourceTypesRequest struct to update resource types in account type UpdateResourceTypesRequest struct { // ID of resource group // Required: true @@ -26,12 +26,11 @@ type UpdateResourceTypesRequest struct { ResTypes []string `url:"resourceTypes" json:"resourceTypes" validate:"min=1,resTypes"` } +// UpdateResourceTypes updates resource types in account func (r RG) UpdateResourceTypes(ctx context.Context, req UpdateResourceTypesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/updateResourceTypes" diff --git a/pkg/cloudbroker/rg/usage.go b/pkg/cloudbroker/rg/usage.go index 609f6af..31d2d08 100644 --- a/pkg/cloudbroker/rg/usage.go +++ b/pkg/cloudbroker/rg/usage.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get report of resource usage +// UsageRequest struct to get report of resource usage type UsageRequest struct { // Resource group ID // Required: true @@ -23,9 +23,7 @@ type UsageRequest struct { func (r RG) Usage(ctx context.Context, req UsageRequest) (*Reservation, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/rg/usage" diff --git a/pkg/cloudbroker/sep/access_grant.go b/pkg/cloudbroker/sep/access_grant.go index 22d32fc..7968da6 100644 --- a/pkg/cloudbroker/sep/access_grant.go +++ b/pkg/cloudbroker/sep/access_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to SEP +// AccessGrantRequest struct to grant access to SEP type AccessGrantRequest struct { // Storage endpoint provider ID // Required: true @@ -20,13 +20,11 @@ type AccessGrantRequest struct { AccountID uint64 `url:"account_id" json:"account_id" validate:"required"` } -// AccessGrant grant access to SEP +// AccessGrant grants access to SEP func (s SEP) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/accessGrant" diff --git a/pkg/cloudbroker/sep/access_grant_to_pool.go b/pkg/cloudbroker/sep/access_grant_to_pool.go index 9bdefce..c5a9cf9 100644 --- a/pkg/cloudbroker/sep/access_grant_to_pool.go +++ b/pkg/cloudbroker/sep/access_grant_to_pool.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to pool SEP +// AccessGrantToPoolRequest struct to grant access to pool SEP type AccessGrantToPoolRequest struct { // Storage endpoint provider ID // Required: true @@ -27,13 +27,11 @@ type AccessGrantToPoolRequest struct { RGID uint64 `url:"resgroup_id,omitempty" json:"resgroup_id,omitempty"` } -// AccessGrantToPool grant access to pool SEP +// AccessGrantToPool grants access to pool SEP func (s SEP) AccessGrantToPool(ctx context.Context, req AccessGrantToPoolRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/accessGrantToPool" diff --git a/pkg/cloudbroker/sep/access_revoke.go b/pkg/cloudbroker/sep/access_revoke.go index d0ba4bc..8ccff2f 100644 --- a/pkg/cloudbroker/sep/access_revoke.go +++ b/pkg/cloudbroker/sep/access_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to SEP +// AccessRevokeRequest struct to revoke access to SEP type AccessRevokeRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type AccessRevokeRequest struct { AccountID uint64 `url:"account_id" json:"account_id" validate:"required"` } -// AccessRevoke revoke access to SEP +// AccessRevoke revokes access to SEP func (s SEP) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/accessRevoke" diff --git a/pkg/cloudbroker/sep/access_revoke_to_pool.go b/pkg/cloudbroker/sep/access_revoke_to_pool.go index 2ebc1fe..ea5f850 100644 --- a/pkg/cloudbroker/sep/access_revoke_to_pool.go +++ b/pkg/cloudbroker/sep/access_revoke_to_pool.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to pool SEP +// AccessRevokeToPoolRequest struct to revoke access to pool SEP type AccessRevokeToPoolRequest struct { // Storage endpoint provider ID // Required: true @@ -27,13 +27,11 @@ type AccessRevokeToPoolRequest struct { RGID uint64 `url:"resgroup_id,omitempty" json:"resgroup_id,omitempty"` } -// AccessRevokeToPool revoke access to pool SEP +// AccessRevokeToPool revokes access to pool SEP func (s SEP) AccessRevokeToPool(ctx context.Context, req AccessRevokeToPoolRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/accessRevokeToPool" diff --git a/pkg/cloudbroker/sep/add_consumer_nodes.go b/pkg/cloudbroker/sep/add_consumer_nodes.go index 9dfe1a8..9fd4cd0 100644 --- a/pkg/cloudbroker/sep/add_consumer_nodes.go +++ b/pkg/cloudbroker/sep/add_consumer_nodes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add consumer nodes +// AddConsumerNodesRequest struct to add consumer nodes type AddConsumerNodesRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type AddConsumerNodesRequest struct { ConsumerNIDs []uint64 `url:"consumer_nids" json:"consumer_nids" validate:"min=1"` } -// AddConsumerNodes add consumer nodes to SEP parameters +// AddConsumerNodes adds consumer nodes to SEP parameters func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/addConsumerNodes" diff --git a/pkg/cloudbroker/sep/add_provider_nodes.go b/pkg/cloudbroker/sep/add_provider_nodes.go index 219775e..d5c8371 100644 --- a/pkg/cloudbroker/sep/add_provider_nodes.go +++ b/pkg/cloudbroker/sep/add_provider_nodes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add provider nodes +// AddProviderNodesRequest struct to add provider nodes type AddProviderNodesRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type AddProviderNodesRequest struct { ProviderNIDs []uint64 `url:"provider_nids" json:"provider_nids" validate:"min=1"` } -// AddProviderNodes add provider nodes to SEP parameters +// AddProviderNodes adds provider nodes to SEP parameters func (s SEP) AddProviderNodes(ctx context.Context, req AddProviderNodesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/addProviderNodes" diff --git a/pkg/cloudbroker/sep/config_field_edit.go b/pkg/cloudbroker/sep/config_field_edit.go index 641f769..6aa8d28 100644 --- a/pkg/cloudbroker/sep/config_field_edit.go +++ b/pkg/cloudbroker/sep/config_field_edit.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for edit config fields +// ConfigFieldEditRequest struct to edit config fields type ConfigFieldEditRequest struct { // Storage endpoint provider ID // Required: true @@ -33,13 +33,11 @@ type ConfigFieldEditRequest struct { FieldType string `url:"field_type" json:"field_type" validate:"sepFieldType"` } -// ConfigFieldEdit edit SEP config field value +// ConfigFieldEdit edits SEP config field value func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/configFieldEdit" diff --git a/pkg/cloudbroker/sep/config_insert.go b/pkg/cloudbroker/sep/config_insert.go index 6f7eb94..d0f0e43 100644 --- a/pkg/cloudbroker/sep/config_insert.go +++ b/pkg/cloudbroker/sep/config_insert.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for insert config +// ConfigInsertRequest struct to insert config type ConfigInsertRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type ConfigInsertRequest struct { Config string `url:"config" json:"config" validate:"required"` } -// ConfigInsert insert config to SEP +// ConfigInsert inserts config to SEP func (s SEP) ConfigInsert(ctx context.Context, req ConfigInsertRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/configInsert" diff --git a/pkg/cloudbroker/sep/config_validate.go b/pkg/cloudbroker/sep/config_validate.go index dfef548..acd1662 100644 --- a/pkg/cloudbroker/sep/config_validate.go +++ b/pkg/cloudbroker/sep/config_validate.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for validate config +// ConfigValidateRequest struct to validate config type ConfigValidateRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type ConfigValidateRequest struct { Config string `url:"config" json:"config" validate:"required"` } -// ConfigValidate verify config for the SEP +// ConfigValidate verifies config for the SEP func (s SEP) ConfigValidate(ctx context.Context, req ConfigValidateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/configValidate" diff --git a/pkg/cloudbroker/sep/consumption.go b/pkg/cloudbroker/sep/consumption.go index 433ae67..8963d21 100644 --- a/pkg/cloudbroker/sep/consumption.go +++ b/pkg/cloudbroker/sep/consumption.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get consumption info +// ConsumptionRequest struct to get consumption info type ConsumptionRequest struct { // Storage endpoint provider ID // Required: true SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"` } -// Consumption get SEP consumption info +// Consumption gets SEP consumption info func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordConsumption, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/consumption" diff --git a/pkg/cloudbroker/sep/create.go b/pkg/cloudbroker/sep/create.go index 2c86210..17e77a1 100644 --- a/pkg/cloudbroker/sep/create.go +++ b/pkg/cloudbroker/sep/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create SEP object +// CreateRequest struct to create SEP object type CreateRequest struct { // Grid ID // Required: true @@ -47,9 +47,7 @@ type CreateRequest struct { func (s SEP) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/create" diff --git a/pkg/cloudbroker/sep/decommission.go b/pkg/cloudbroker/sep/decommission.go index da6136d..948c714 100644 --- a/pkg/cloudbroker/sep/decommission.go +++ b/pkg/cloudbroker/sep/decommission.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for decommission +// DecommissionRequest struct for decommission type DecommissionRequest struct { // Storage endpoint provider ID // Required: true @@ -23,9 +23,7 @@ type DecommissionRequest struct { func (s SEP) Decommission(ctx context.Context, req DecommissionRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/decommission" diff --git a/pkg/cloudbroker/sep/del_consumer_nodes.go b/pkg/cloudbroker/sep/del_consumer_nodes.go index 7fc8f1c..8dcbd81 100644 --- a/pkg/cloudbroker/sep/del_consumer_nodes.go +++ b/pkg/cloudbroker/sep/del_consumer_nodes.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for exclude consumer nodes +// DelConsumerNodesRequest struct to exclude consumer nodes type DelConsumerNodesRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type DelConsumerNodesRequest struct { ConsumerNIDs []uint64 `url:"consumer_nids" json:"consumer_nids" validate:"min=1"` } -// DelConsumerNodes exclude consumer nodes from SEP parameters +// DelConsumerNodes excludes consumer nodes from SEP parameters func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/delConsumerNodes" diff --git a/pkg/cloudbroker/sep/delete.go b/pkg/cloudbroker/sep/delete.go index b51b748..84b7f45 100644 --- a/pkg/cloudbroker/sep/delete.go +++ b/pkg/cloudbroker/sep/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete SEP +// DeleteRequest struct to delete SEP type DeleteRequest struct { // Storage endpoint provider ID // Required: true @@ -19,9 +19,7 @@ type DeleteRequest struct { func (s SEP) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/delete" diff --git a/pkg/cloudbroker/sep/disable.go b/pkg/cloudbroker/sep/disable.go index 7abd2d7..b30b635 100644 --- a/pkg/cloudbroker/sep/disable.go +++ b/pkg/cloudbroker/sep/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable SEP +// DisableRequest struct to disable SEP type DisableRequest struct { // Storage endpoint provider ID // Required: true @@ -19,9 +19,7 @@ type DisableRequest struct { func (s SEP) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/disable" diff --git a/pkg/cloudbroker/sep/disk_list.go b/pkg/cloudbroker/sep/disk_list.go index 4b112bc..96a7eb5 100644 --- a/pkg/cloudbroker/sep/disk_list.go +++ b/pkg/cloudbroker/sep/disk_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of disk IDs +// DiskListRequest struct to get list of disk IDs type DiskListRequest struct { // Storage endpoint provider ID // Required: true @@ -19,13 +19,11 @@ type DiskListRequest struct { PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"` } -// DiskList get list of disk IDs, who use this SEP and pool (if provided) +// DiskList gets list of disk IDs, who use this SEP and pool (if provided) func (s SEP) DiskList(ctx context.Context, req DiskListRequest) ([]uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/diskList" diff --git a/pkg/cloudbroker/sep/enable.go b/pkg/cloudbroker/sep/enable.go index f2aaddc..49c44b5 100644 --- a/pkg/cloudbroker/sep/enable.go +++ b/pkg/cloudbroker/sep/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable SEP +// EnableRequest struct to enable SEP type EnableRequest struct { // Storage endpoint provider ID // Required: true @@ -19,9 +19,7 @@ type EnableRequest struct { func (s SEP) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/enable" diff --git a/pkg/cloudbroker/sep/get.go b/pkg/cloudbroker/sep/get.go index 3c45a99..7e0be94 100644 --- a/pkg/cloudbroker/sep/get.go +++ b/pkg/cloudbroker/sep/get.go @@ -36,9 +36,7 @@ func (s SEP) Get(ctx context.Context, req GetRequest) (*RecordSEP, error) { func (s SEP) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/get" diff --git a/pkg/cloudbroker/sep/get_config.go b/pkg/cloudbroker/sep/get_config.go index 2b72470..ab0b213 100644 --- a/pkg/cloudbroker/sep/get_config.go +++ b/pkg/cloudbroker/sep/get_config.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get SEP config +// GetConfigRequest struct to get SEP config type GetConfigRequest struct { // Storage endpoint provider ID // Required: true @@ -19,9 +19,7 @@ type GetConfigRequest struct { func (s SEP) GetConfig(ctx context.Context, req GetConfigRequest) (*SEPConfig, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/getConfig" diff --git a/pkg/cloudbroker/sep/get_pool.go b/pkg/cloudbroker/sep/get_pool.go index cfcef93..81ce45c 100644 --- a/pkg/cloudbroker/sep/get_pool.go +++ b/pkg/cloudbroker/sep/get_pool.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get SEP pool config by name +// GetPoolRequest struct to get SEP pool config by name type GetPoolRequest struct { // Storage endpoint provider ID // Required: true @@ -23,9 +23,7 @@ type GetPoolRequest struct { func (s SEP) GetPool(ctx context.Context, req GetPoolRequest) (*RecordPool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/getPool" diff --git a/pkg/cloudbroker/sep/update_capacity_limit.go b/pkg/cloudbroker/sep/update_capacity_limit.go index f7b93ec..c49678c 100644 --- a/pkg/cloudbroker/sep/update_capacity_limit.go +++ b/pkg/cloudbroker/sep/update_capacity_limit.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update capacity limits +// UpdateCapacityLimitRequest struct to update capacity limits type UpdateCapacityLimitRequest struct { // Storage endpoint provider ID // Required: true @@ -19,9 +19,7 @@ type UpdateCapacityLimitRequest struct { func (s SEP) UpdateCapacityLimit(ctx context.Context, req UpdateCapacityLimitRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/updateCapacityLimit" diff --git a/pkg/cloudbroker/stack/get.go b/pkg/cloudbroker/stack/get.go index 143caaf..31e2082 100644 --- a/pkg/cloudbroker/stack/get.go +++ b/pkg/cloudbroker/stack/get.go @@ -36,9 +36,7 @@ func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) { func (i Stack) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/stack/get" diff --git a/pkg/cloudbroker/tasks/get.go b/pkg/cloudbroker/tasks/get.go index 42a8e7e..e75d9a2 100644 --- a/pkg/cloudbroker/tasks/get.go +++ b/pkg/cloudbroker/tasks/get.go @@ -36,9 +36,7 @@ func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordTask, error) { func (t Tasks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/tasks/get" diff --git a/pkg/cloudbroker/user/api_list.go b/pkg/cloudbroker/user/api_list.go index dc2b303..5037137 100644 --- a/pkg/cloudbroker/user/api_list.go +++ b/pkg/cloudbroker/user/api_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting API list. +// APIListRequest struct for getting API list. type APIListRequest struct { // ID of the user. // Required: true @@ -20,9 +20,7 @@ type APIListRequest struct { func (u User) APIList(ctx context.Context, req APIListRequest) (*APIsEndpoints, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/apiList" diff --git a/pkg/cloudbroker/user/apiaccess_join.go b/pkg/cloudbroker/user/apiaccess_join.go index 3306165..5b60532 100644 --- a/pkg/cloudbroker/user/apiaccess_join.go +++ b/pkg/cloudbroker/user/apiaccess_join.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for joining user into apiaccess group. +// APIAccessJoinRequest struct for joining user into apiaccess group. type APIAccessJoinRequest struct { // ID of the user whose membership will be updated. // Required: true @@ -23,9 +23,7 @@ type APIAccessJoinRequest struct { func (u User) APIAccessJoin(ctx context.Context, req APIAccessJoinRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/apiaccessJoin" diff --git a/pkg/cloudbroker/user/apiaccess_leave.go b/pkg/cloudbroker/user/apiaccess_leave.go index 02e645e..36d2c61 100644 --- a/pkg/cloudbroker/user/apiaccess_leave.go +++ b/pkg/cloudbroker/user/apiaccess_leave.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for leaving user from apiaccess group. +// APIAccessLeaveRequest struct for leaving user from apiaccess group. type APIAccessLeaveRequest struct { // ID of the user whose membership will be updated. // Required: true @@ -23,9 +23,7 @@ type APIAccessLeaveRequest struct { func (u User) APIAccessLeave(ctx context.Context, req APIAccessLeaveRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/apiaccessLeave" diff --git a/pkg/cloudbroker/user/apiaccess_list.go b/pkg/cloudbroker/user/apiaccess_list.go index cbbeb36..14eebe4 100644 --- a/pkg/cloudbroker/user/apiaccess_list.go +++ b/pkg/cloudbroker/user/apiaccess_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for showing list of dicts with information about +// APIAccessListRequest struct for showing list of dicts with information about // apiaccess groups contains to the user. type APIAccessListRequest struct { // ID of the user to list API access groups for. @@ -20,9 +20,7 @@ type APIAccessListRequest struct { func (u User) APIAccessList(ctx context.Context, req APIAccessListRequest) (ListAPIAccess, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/apiaccessList" diff --git a/pkg/cloudbroker/user/create.go b/pkg/cloudbroker/user/create.go index 7053284..a3f4e48 100644 --- a/pkg/cloudbroker/user/create.go +++ b/pkg/cloudbroker/user/create.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for creating a user. +// CreateRequest struct for creating a user. type CreateRequest struct { // ID of user. // Required: true @@ -35,9 +35,7 @@ type CreateRequest struct { func (u User) Create(ctx context.Context, req CreateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/create" diff --git a/pkg/cloudbroker/user/delete.go b/pkg/cloudbroker/user/delete.go index 55dd898..ad3ec21 100644 --- a/pkg/cloudbroker/user/delete.go +++ b/pkg/cloudbroker/user/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for deleting a user. +// DeleteRequest struct for deleting a user. type DeleteRequest struct { // ID of user. // Required: true @@ -19,9 +19,7 @@ type DeleteRequest struct { func (u User) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/delete" diff --git a/pkg/cloudbroker/user/delete_by_guid.go b/pkg/cloudbroker/user/delete_by_guid.go index fbd9212..d4c49fc 100644 --- a/pkg/cloudbroker/user/delete_by_guid.go +++ b/pkg/cloudbroker/user/delete_by_guid.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for deleting a user using user's GUID. +// DeleteByGUIDRequest struct for deleting a user using user's GUID. type DeleteByGUIDRequest struct { // GUID of user. // Required: true @@ -21,9 +21,7 @@ type DeleteByGUIDRequest struct { func (u User) DeleteByGUID(ctx context.Context, req DeleteByGUIDRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/deleteByGuid" diff --git a/pkg/cloudbroker/user/delete_users.go b/pkg/cloudbroker/user/delete_users.go index c6153c3..a879b8e 100644 --- a/pkg/cloudbroker/user/delete_users.go +++ b/pkg/cloudbroker/user/delete_users.go @@ -3,24 +3,22 @@ package user import ( "context" "net/http" - "strconv" - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" + "strconv" ) -// Request struct for bulk delete a list of users. +// DeleteUsersRequest struct for bulk delete a list of users. type DeleteUsersRequest struct { // List of user ids - UserIDs string + // Required: true + UserIDs string `url:"userIds" json:"userIds" validate:"required"` } // DeleteUsers bulk delete a list of users. func (u User) DeleteUsers(ctx context.Context, req DeleteUsersRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/deleteUsers" diff --git a/pkg/cloudbroker/user/get.go b/pkg/cloudbroker/user/get.go index 9641ec8..9ea52ff 100644 --- a/pkg/cloudbroker/user/get.go +++ b/pkg/cloudbroker/user/get.go @@ -36,9 +36,7 @@ func (u User) Get(ctx context.Context, req GetRequest) (*ItemUser, error) { func (u User) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/get" diff --git a/pkg/cloudbroker/user/get_audit.go b/pkg/cloudbroker/user/get_audit.go index 9b7d97e..b30a931 100644 --- a/pkg/cloudbroker/user/get_audit.go +++ b/pkg/cloudbroker/user/get_audit.go @@ -4,11 +4,9 @@ import ( "context" "encoding/json" "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting user's audits. +// GetAuditRequest struct for getting user's audits. type GetAuditRequest struct { // Name of user (get audits for current user if set to empty). // Required: false @@ -23,15 +21,8 @@ type GetAuditRequest struct { Size uint64 `url:"size,omitempty" json:"size,omitempty"` } -// GetAudits gets user's audits. +// GetAudit gets user's audits. func (u User) GetAudit(ctx context.Context, req GetAuditRequest) (ListAudits, error) { - err := validators.ValidateRequest(req) - if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } - } - url := "/cloudbroker/user/getAudit" res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req) diff --git a/pkg/cloudbroker/user/get_matching_usernames.go b/pkg/cloudbroker/user/get_matching_usernames.go index 665cded..9ff5c84 100644 --- a/pkg/cloudbroker/user/get_matching_usernames.go +++ b/pkg/cloudbroker/user/get_matching_usernames.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for getting a list of the matching usernames for a given string. +// GetMatchingUsernamesRequest struct for getting a list of the matching usernames for a given string. type GetMatchingUsernamesRequest struct { // Regex of the usernames to searched for. // Required: true @@ -23,9 +23,7 @@ type GetMatchingUsernamesRequest struct { func (u User) GetMatchingUsernames(ctx context.Context, req GetMatchingUsernamesRequest) (ListMatchingUsernames, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/user/getMatchingUsernames" diff --git a/pkg/cloudbroker/user/list.go b/pkg/cloudbroker/user/list.go index 39a277d..2fc96b9 100644 --- a/pkg/cloudbroker/user/list.go +++ b/pkg/cloudbroker/user/list.go @@ -4,8 +4,6 @@ import ( "context" "encoding/json" "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // ListRequest struct to get all non deleted user instances. @@ -50,13 +48,6 @@ func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) { // ListRaw gets all non deleted user instances as an array of bytes func (u User) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) { - err := validators.ValidateRequest(req) - if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } - } - url := "/cloudbroker/user/list" res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req) diff --git a/pkg/cloudbroker/vgpu/allocate.go b/pkg/cloudbroker/vgpu/allocate.go index 30091a2..2893aa2 100644 --- a/pkg/cloudbroker/vgpu/allocate.go +++ b/pkg/cloudbroker/vgpu/allocate.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for allocating VGPU +// AllocateRequest struct for allocating VGPU type AllocateRequest struct { // Virtual GPU ID // Required: true @@ -18,9 +18,7 @@ type AllocateRequest struct { func (v VGPU) Allocate(ctx context.Context, req AllocateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vgpu/allocate" diff --git a/pkg/cloudbroker/vgpu/create.go b/pkg/cloudbroker/vgpu/create.go index c0c0a3e..90f6384 100644 --- a/pkg/cloudbroker/vgpu/create.go +++ b/pkg/cloudbroker/vgpu/create.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request struct for creating VGPU +// CreateRequest struct for creating VGPU type CreateRequest struct { // ID of pGPU // Required: true @@ -30,9 +30,7 @@ type CreateRequest struct { func (v VGPU) Create(ctx context.Context, req CreateRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vgpu/create" diff --git a/pkg/cloudbroker/vgpu/deallocate.go b/pkg/cloudbroker/vgpu/deallocate.go index 0fc627e..81b67cf 100644 --- a/pkg/cloudbroker/vgpu/deallocate.go +++ b/pkg/cloudbroker/vgpu/deallocate.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for deallocating VGPU +// DeallocateRequest struct for deallocating VGPU type DeallocateRequest struct { // Virtual GPU ID // Required: true @@ -22,9 +22,7 @@ type DeallocateRequest struct { func (v VGPU) Deallocate(ctx context.Context, req DeallocateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vgpu/deallocate" diff --git a/pkg/cloudbroker/vgpu/destroy.go b/pkg/cloudbroker/vgpu/destroy.go index 5db1ab6..ab03c95 100644 --- a/pkg/cloudbroker/vgpu/destroy.go +++ b/pkg/cloudbroker/vgpu/destroy.go @@ -7,7 +7,7 @@ import ( "strconv" ) -// Request for destroying VGPU +// DestroyRequest struct for destroying VGPU type DestroyRequest struct { // Virtual GPU ID // Required: true @@ -22,9 +22,7 @@ type DestroyRequest struct { func (v VGPU) Destroy(ctx context.Context, req DestroyRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vgpu/destroy" diff --git a/pkg/cloudbroker/vins/audits.go b/pkg/cloudbroker/vins/audits.go index abf2f58..af345e7 100644 --- a/pkg/cloudbroker/vins/audits.go +++ b/pkg/cloudbroker/vins/audits.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get audits +// AuditsRequest struct to get audits type AuditsRequest struct { // ID of the VINS // Required: true @@ -19,9 +19,7 @@ type AuditsRequest struct { func (v VINS) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/audits" diff --git a/pkg/cloudbroker/vins/create_in_account.go b/pkg/cloudbroker/vins/create_in_account.go index 04375c7..2257098 100644 --- a/pkg/cloudbroker/vins/create_in_account.go +++ b/pkg/cloudbroker/vins/create_in_account.go @@ -20,7 +20,7 @@ type Route struct { Gateway string `url:"gateway" json:"gateway" validate:"required"` } -// Request struct for create VINS in account +// CreateInAccountRequest struct to create VINS in account type CreateInAccountRequest struct { // VINS name // Required: true @@ -64,9 +64,7 @@ type wrapperCreateRequestInAcc struct { func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var routes []string @@ -82,13 +80,13 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) ( routes = append(routes, string(b)) } - } else { + } else { routes = []string{"[]"} } reqWrapped := wrapperCreateRequestInAcc{ CreateInAccountRequest: req, - Routes: routes, + Routes: routes, } url := "/cloudbroker/vins/createInAccount" diff --git a/pkg/cloudbroker/vins/create_in_rg.go b/pkg/cloudbroker/vins/create_in_rg.go index 28af320..7b90b59 100644 --- a/pkg/cloudbroker/vins/create_in_rg.go +++ b/pkg/cloudbroker/vins/create_in_rg.go @@ -9,7 +9,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create VINS in resource group +// CreateInRGRequest struct to create VINS in resource group type CreateInRGRequest struct { // VINS name // Required: true @@ -57,9 +57,7 @@ type wrapperCreateRequestInRG struct { func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } var routes []string diff --git a/pkg/cloudbroker/vins/default_qos_update.go b/pkg/cloudbroker/vins/default_qos_update.go index be8ec64..6d78ae3 100644 --- a/pkg/cloudbroker/vins/default_qos_update.go +++ b/pkg/cloudbroker/vins/default_qos_update.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update QOS +// DefaultQOSUpdateRequest struct to update QOS type DefaultQOSUpdateRequest struct { // ID of VINS // Required: true @@ -27,13 +27,11 @@ type DefaultQOSUpdateRequest struct { EgressRate uint64 `url:"egress_rate,omitempty" json:"egress_rate,omitempty"` } -// DefaultQOSUpdate update default QOS values +// DefaultQOSUpdate updates default QOS values func (v VINS) DefaultQOSUpdate(ctx context.Context, req DefaultQOSUpdateRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/defaultQosUpdate" diff --git a/pkg/cloudbroker/vins/delete.go b/pkg/cloudbroker/vins/delete.go index 73e5cff..6c60455 100644 --- a/pkg/cloudbroker/vins/delete.go +++ b/pkg/cloudbroker/vins/delete.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete VINS +// DeleteRequest struct to delete VINS type DeleteRequest struct { // VINS ID // Required: true @@ -35,9 +35,7 @@ type DeleteRequest struct { func (v VINS) Delete(ctx context.Context, req DeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/delete" diff --git a/pkg/cloudbroker/vins/disable.go b/pkg/cloudbroker/vins/disable.go index c25deae..7da0144 100644 --- a/pkg/cloudbroker/vins/disable.go +++ b/pkg/cloudbroker/vins/disable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable VINS +// DisableRequest struct to disable VINS type DisableRequest struct { // VINS ID // Required: true @@ -23,9 +23,7 @@ type DisableRequest struct { func (v VINS) Disable(ctx context.Context, req DisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/disable" diff --git a/pkg/cloudbroker/vins/enable.go b/pkg/cloudbroker/vins/enable.go index c9478eb..bbf83a7 100644 --- a/pkg/cloudbroker/vins/enable.go +++ b/pkg/cloudbroker/vins/enable.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable VINS +// EnableRequest struct to enable VINS type EnableRequest struct { // VINS ID // Required: true @@ -23,9 +23,7 @@ type EnableRequest struct { func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/enable" diff --git a/pkg/cloudbroker/vins/extnet_connect.go b/pkg/cloudbroker/vins/extnet_connect.go index cabe706..38ce70e 100644 --- a/pkg/cloudbroker/vins/extnet_connect.go +++ b/pkg/cloudbroker/vins/extnet_connect.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for connect external network +// ExtNetConnectRequest struct to connect external network type ExtNetConnectRequest struct { // VINS ID // Required: true @@ -27,13 +27,11 @@ type ExtNetConnectRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// ExtNetConnect connect VINS to external network +// ExtNetConnect connects VINS to external network func (v VINS) ExtNetConnect(ctx context.Context, req ExtNetConnectRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/extNetConnect" diff --git a/pkg/cloudbroker/vins/extnet_disconnect.go b/pkg/cloudbroker/vins/extnet_disconnect.go index 5f63bfd..0fc9928 100644 --- a/pkg/cloudbroker/vins/extnet_disconnect.go +++ b/pkg/cloudbroker/vins/extnet_disconnect.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disconnect VINS from external network +// ExtNetDisconnectRequest struct to disconnect VINS from external network type ExtNetDisconnectRequest struct { // VINS ID // Required: true @@ -19,13 +19,11 @@ type ExtNetDisconnectRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// ExtNetDisconnect disconnect VINS from external network +// ExtNetDisconnect disconnects VINS from external network func (v VINS) ExtNetDisconnect(ctx context.Context, req ExtNetDisconnectRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/extNetDisconnect" diff --git a/pkg/cloudbroker/vins/extnet_list.go b/pkg/cloudbroker/vins/extnet_list.go index fe52d4d..625ec65 100644 --- a/pkg/cloudbroker/vins/extnet_list.go +++ b/pkg/cloudbroker/vins/extnet_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list VINS external network connections +// ExtNetListRequest struct to get list of VINS external network connections type ExtNetListRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// ExtNetList show list of VINS external network connections +// ExtNetList shows list of VINS external network connections func (v VINS) ExtNetList(ctx context.Context, req ExtNetListRequest) (*ListExtNets, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/extNetList" diff --git a/pkg/cloudbroker/vins/get.go b/pkg/cloudbroker/vins/get.go index 6bc4df2..77f2b15 100644 --- a/pkg/cloudbroker/vins/get.go +++ b/pkg/cloudbroker/vins/get.go @@ -40,9 +40,7 @@ func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) { func (v VINS) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/get" diff --git a/pkg/cloudbroker/vins/ip_list.go b/pkg/cloudbroker/vins/ip_list.go index 136adea..9a466c5 100644 --- a/pkg/cloudbroker/vins/ip_list.go +++ b/pkg/cloudbroker/vins/ip_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for DHCP IP +// IPListRequest struct for DHCP IP type IPListRequest struct { // VINS ID // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// IPList show DHCP IP reservations on VINS +// IPList shows DHCP IP reservations on VINS func (v VINS) IPList(ctx context.Context, req IPListRequest) (*ListIPs, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/ipList" diff --git a/pkg/cloudbroker/vins/ip_release.go b/pkg/cloudbroker/vins/ip_release.go index b6a1db6..f53fdb7 100644 --- a/pkg/cloudbroker/vins/ip_release.go +++ b/pkg/cloudbroker/vins/ip_release.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for IP relese +// IPReleaseRequest struct for IP release type IPReleaseRequest struct { // VINS ID // Required: true @@ -23,14 +23,12 @@ type IPReleaseRequest struct { MAC string `url:"mac,omitempty" json:"mac,omitempty"` } -// IPRelese delete IP reservation matched by specified IP & MAC address combination. +// IPRelease delete IP reservation matched by specified IP & MAC address combination. // If both IP and MAC address are empty strings, all IP reservations will be deleted. func (v VINS) IPRelease(ctx context.Context, req IPReleaseRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/ipRelease" diff --git a/pkg/cloudbroker/vins/ip_reserve.go b/pkg/cloudbroker/vins/ip_reserve.go index 001ed41..3abd913 100644 --- a/pkg/cloudbroker/vins/ip_reserve.go +++ b/pkg/cloudbroker/vins/ip_reserve.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for IP reserve +// IPReserveRequest struct for IP reserve type IPReserveRequest struct { // VINS ID // Required: true @@ -47,9 +47,7 @@ type IPReserveRequest struct { func (v VINS) IPReserve(ctx context.Context, req IPReserveRequest) (string, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return "", validators.ValidationError(validationError) - } + return "", validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/ipReserve" diff --git a/pkg/cloudbroker/vins/list_deleted.go b/pkg/cloudbroker/vins/list_deleted.go index 8a78582..6a0335c 100644 --- a/pkg/cloudbroker/vins/list_deleted.go +++ b/pkg/cloudbroker/vins/list_deleted.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for get list of deleted VINSes +// ListDeletedRequest struct to get list of deleted VINSes type ListDeletedRequest struct { // Find by ID // Required: false diff --git a/pkg/cloudbroker/vins/mass_delete.go b/pkg/cloudbroker/vins/mass_delete.go index 0a55be4..d84efb5 100644 --- a/pkg/cloudbroker/vins/mass_delete.go +++ b/pkg/cloudbroker/vins/mass_delete.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete several VINSes +// MassDeleteRequest struct to delete several VINSes type MassDeleteRequest struct { // VINS IDs // Required: true @@ -35,9 +35,7 @@ type MassDeleteRequest struct { func (v VINS) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/massDelete" diff --git a/pkg/cloudbroker/vins/mass_disable.go b/pkg/cloudbroker/vins/mass_disable.go index bd54b12..7d9d5f8 100644 --- a/pkg/cloudbroker/vins/mass_disable.go +++ b/pkg/cloudbroker/vins/mass_disable.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for disable several VINSes +// MassDisableRequest struct to disable several VINSes type MassDisableRequest struct { // VINS IDs // Required: true @@ -22,9 +22,7 @@ type MassDisableRequest struct { func (v VINS) MassDisable(ctx context.Context, req MassDisableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/massDisable" diff --git a/pkg/cloudbroker/vins/mass_enable.go b/pkg/cloudbroker/vins/mass_enable.go index 565445c..df8b7a8 100644 --- a/pkg/cloudbroker/vins/mass_enable.go +++ b/pkg/cloudbroker/vins/mass_enable.go @@ -7,7 +7,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for enable several VINSes +// MassEnableRequest struct to enable several VINSes type MassEnableRequest struct { // VINS IDs // Required: true @@ -22,9 +22,7 @@ type MassEnableRequest struct { func (v VINS) MassEnable(ctx context.Context, req MassEnableRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/massEnable" diff --git a/pkg/cloudbroker/vins/nat_rule_add.go b/pkg/cloudbroker/vins/nat_rule_add.go index ab07f6e..a949a9e 100644 --- a/pkg/cloudbroker/vins/nat_rule_add.go +++ b/pkg/cloudbroker/vins/nat_rule_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for create NAT rules +// NATRuleAddRequest struct to create NAT rules type NATRuleAddRequest struct { // VINS ID // Required: true @@ -42,13 +42,11 @@ type NATRuleAddRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// NATRuleAdd create NAT (port forwarding) rule on VINS +// NATRuleAdd creates NAT (port forwarding) rule on VINS func (v VINS) NATRuleAdd(ctx context.Context, req NATRuleAddRequest) (uint64, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return 0, validators.ValidationError(validationError) - } + return 0, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/natRuleAdd" diff --git a/pkg/cloudbroker/vins/nat_rule_del.go b/pkg/cloudbroker/vins/nat_rule_del.go index 58a06e4..409dadb 100644 --- a/pkg/cloudbroker/vins/nat_rule_del.go +++ b/pkg/cloudbroker/vins/nat_rule_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for delete NAT rule +// NATRuleDelRequest struct to delete NAT rule type NATRuleDelRequest struct { // VINS ID // Required: true @@ -24,13 +24,11 @@ type NATRuleDelRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// NATRuleDel delete NAT (port forwarding) rule on VINS +// NATRuleDel deletes NAT (port forwarding) rule on VINS func (v VINS) NATRuleDel(ctx context.Context, req NATRuleDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/natRuleDel" diff --git a/pkg/cloudbroker/vins/nat_rule_list.go b/pkg/cloudbroker/vins/nat_rule_list.go index aa0afab..4333452 100644 --- a/pkg/cloudbroker/vins/nat_rule_list.go +++ b/pkg/cloudbroker/vins/nat_rule_list.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for get list of NAT rules +// NATRuleListRequest struct to get list of NAT rules type NATRuleListRequest struct { // VINS ID // Required: true @@ -23,9 +23,7 @@ type NATRuleListRequest struct { func (v VINS) NATRuleList(ctx context.Context, req NATRuleListRequest) (*ListNATRules, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/natRuleList" diff --git a/pkg/cloudbroker/vins/net_qos.go b/pkg/cloudbroker/vins/net_qos.go index 7181f2d..c315c40 100644 --- a/pkg/cloudbroker/vins/net_qos.go +++ b/pkg/cloudbroker/vins/net_qos.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for update all VINS interfaces QOS +// NetQOSRequest struct to update all VINS interfaces QOS type NetQOSRequest struct { // VINS ID // Required: true @@ -31,9 +31,7 @@ type NetQOSRequest struct { func (v VINS) NetQOS(ctx context.Context, req NetQOSRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/netQos" diff --git a/pkg/cloudbroker/vins/restore.go b/pkg/cloudbroker/vins/restore.go index 2dd0c45..5c188ff 100644 --- a/pkg/cloudbroker/vins/restore.go +++ b/pkg/cloudbroker/vins/restore.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for restore +// RestoreRequest struct for restore type RestoreRequest struct { // VINS ID // Required: true @@ -23,9 +23,7 @@ type RestoreRequest struct { func (v VINS) Restore(ctx context.Context, req RestoreRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/restore" diff --git a/pkg/cloudbroker/vins/search.go b/pkg/cloudbroker/vins/search.go index 7c80fce..a8884a0 100644 --- a/pkg/cloudbroker/vins/search.go +++ b/pkg/cloudbroker/vins/search.go @@ -6,7 +6,7 @@ import ( "net/http" ) -// Request struct for search VINSes +// SearchRequest struct to search VINSes type SearchRequest struct { // ID of the account to search for the ViNSes // Required: false @@ -29,7 +29,7 @@ type SearchRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// Search search VINSes +// Search searches VINSes func (v VINS) Search(ctx context.Context, req SearchRequest) (SearchVINS, error) { url := "/cloudbroker/vins/search" diff --git a/pkg/cloudbroker/vins/static_route_access_grant.go b/pkg/cloudbroker/vins/static_route_access_grant.go index 10a139e..224953b 100644 --- a/pkg/cloudbroker/vins/static_route_access_grant.go +++ b/pkg/cloudbroker/vins/static_route_access_grant.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for grant access to static route to Compute/ViNS +// StaticRouteAccessGrantRequest struct to grant access to static route to Compute/ViNS type StaticRouteAccessGrantRequest struct { // ViNS ID to grant access // Required: true @@ -23,13 +23,11 @@ type StaticRouteAccessGrantRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// Grant access to static route to Compute/ViNS +// StaticRouteAccessGrant grants access to static route to Compute/ViNS func (v VINS) StaticRouteAccessGrant(ctx context.Context, req StaticRouteAccessGrantRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/staticRouteAccessGrant" diff --git a/pkg/cloudbroker/vins/static_route_access_revoke.go b/pkg/cloudbroker/vins/static_route_access_revoke.go index e18a859..35864b2 100644 --- a/pkg/cloudbroker/vins/static_route_access_revoke.go +++ b/pkg/cloudbroker/vins/static_route_access_revoke.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for revoke access to static route to Compute/ViNS +// StaticRouteAccessRevokeRequest struct to revoke access to static route to Compute/ViNS type StaticRouteAccessRevokeRequest struct { // ViNS ID to revoke access // Required: true @@ -23,13 +23,11 @@ type StaticRouteAccessRevokeRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// Revoke access to static route to Compute/ViNS +// StaticRouteAccessRevoke revokes access to static route to Compute/ViNS func (v VINS) StaticRouteAccessRevoke(ctx context.Context, req StaticRouteAccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/staticRouteAccessRevoke" diff --git a/pkg/cloudbroker/vins/static_route_add.go b/pkg/cloudbroker/vins/static_route_add.go index b2ad2ce..61e7080 100644 --- a/pkg/cloudbroker/vins/static_route_add.go +++ b/pkg/cloudbroker/vins/static_route_add.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for add static route +// StaticRouteAddRequest struct to add static route type StaticRouteAddRequest struct { // VINS ID // Required: true @@ -31,13 +31,11 @@ type StaticRouteAddRequest struct { ComputeIds []uint64 `url:"computeIds,omitempty" json:"computeIds,omitempty"` } -// StaticRouteAdd add new static route to ViNS +// StaticRouteAdd adds new static route to ViNS func (v VINS) StaticRouteAdd(ctx context.Context, req StaticRouteAddRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/staticRouteAdd" diff --git a/pkg/cloudbroker/vins/static_route_del.go b/pkg/cloudbroker/vins/static_route_del.go index d01e50d..2013169 100644 --- a/pkg/cloudbroker/vins/static_route_del.go +++ b/pkg/cloudbroker/vins/static_route_del.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for remove static route from ViNS +// StaticRouteDelRequest struct to remove static route from ViNS type StaticRouteDelRequest struct { // ViNS ID to remove static route from // Required: true @@ -19,13 +19,11 @@ type StaticRouteDelRequest struct { RouteId uint64 `url:"routeId" json:"routeId" validate:"required"` } -// Remove static route from ViNS +// StaticRouteDel removes static route from ViNS func (v VINS) StaticRouteDel(ctx context.Context, req StaticRouteDelRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/staticRouteDel" diff --git a/pkg/cloudbroker/vins/static_route_list.go b/pkg/cloudbroker/vins/static_route_list.go index 40ba122..8e82cbf 100644 --- a/pkg/cloudbroker/vins/static_route_list.go +++ b/pkg/cloudbroker/vins/static_route_list.go @@ -8,20 +8,18 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for static route list +// StaticRouteListRequest struct for static route list type StaticRouteListRequest struct { // ViNS ID to show list of static routes // Required: true VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"` } -// Show list of static routes for ViNS +// StaticRouteList shows list of static routes for ViNS func (v VINS) StaticRouteList(ctx context.Context, req StaticRouteListRequest) (*ListStaticRoutes, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return nil, validators.ValidationError(validationError) - } + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/staticRouteList" diff --git a/pkg/cloudbroker/vins/vnfdev_redeploy.go b/pkg/cloudbroker/vins/vnfdev_redeploy.go index 2d9b6e0..94bb0b0 100644 --- a/pkg/cloudbroker/vins/vnfdev_redeploy.go +++ b/pkg/cloudbroker/vins/vnfdev_redeploy.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for redeploy VNF devices +// VNFDevRedeployRequest struct to redeploy VNF devices type VNFDevRedeployRequest struct { // VINS ID // Required: true @@ -19,13 +19,11 @@ type VNFDevRedeployRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// VNFDevRedeploy redeploy VINS VNFDevs +// VNFDevRedeploy redeploys VINS VNFDevs func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/vnfdevRedeploy" diff --git a/pkg/cloudbroker/vins/vnfdev_reset.go b/pkg/cloudbroker/vins/vnfdev_reset.go index 6e82a41..057fe4d 100644 --- a/pkg/cloudbroker/vins/vnfdev_reset.go +++ b/pkg/cloudbroker/vins/vnfdev_reset.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reset VNF device +// VNFDevResetRequest struct to reset VNF device type VNFDevResetRequest struct { // VINS ID // Required: true @@ -19,13 +19,11 @@ type VNFDevResetRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// VNFDevReset reset VINSes primary VNF device +// VNFDevReset resets VINSes primary VNF device func (v VINS) VNFDevReset(ctx context.Context, req VNFDevResetRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/vnfdevReset" diff --git a/pkg/cloudbroker/vins/vnfdev_restart.go b/pkg/cloudbroker/vins/vnfdev_restart.go index 9bd35e2..e97ac74 100644 --- a/pkg/cloudbroker/vins/vnfdev_restart.go +++ b/pkg/cloudbroker/vins/vnfdev_restart.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for reboot VINSes primary VNF device +// VNFDevRestartRequest struct to reboot VINSes primary VNF device type VNFDevRestartRequest struct { // VINS ID // Required: true @@ -19,13 +19,11 @@ type VNFDevRestartRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// VNFDevRestart reboot VINSes primary VNF device +// VNFDevRestart reboots VINSes primary VNF device func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/vnfdevRestart" diff --git a/pkg/cloudbroker/vins/vnfdev_start.go b/pkg/cloudbroker/vins/vnfdev_start.go index c43493d..3872a9b 100644 --- a/pkg/cloudbroker/vins/vnfdev_start.go +++ b/pkg/cloudbroker/vins/vnfdev_start.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for start VNF devices +// VNFDevStartRequest struct to start VNF devices type VNFDevStartRequest struct { // VINS ID // Required: true @@ -23,9 +23,7 @@ type VNFDevStartRequest struct { func (v VINS) VNFDevStart(ctx context.Context, req VNFDevStartRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/vnfdevStart" diff --git a/pkg/cloudbroker/vins/vnfdev_stop.go b/pkg/cloudbroker/vins/vnfdev_stop.go index 22c60e7..ad5a621 100644 --- a/pkg/cloudbroker/vins/vnfdev_stop.go +++ b/pkg/cloudbroker/vins/vnfdev_stop.go @@ -8,7 +8,7 @@ import ( "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) -// Request struct for stop VNF devices +// VNFDevStopRequest struct to stop VNF devices type VNFDevStopRequest struct { // VINS ID // Required: true @@ -19,13 +19,11 @@ type VNFDevStopRequest struct { Reason string `url:"reason,omitempty" json:"reason,omitempty"` } -// VNFDevStop stop VINSes primary VNF device +// VNFDevStop stops VINSes primary VNF device func (v VINS) VNFDevStop(ctx context.Context, req VNFDevStopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { - for _, validationError := range validators.GetErrors(err) { - return false, validators.ValidationError(validationError) - } + return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/vins/vnfdevStop"